Browse Source

fix bugs indicated by coverity

Julius Pfrommer 10 years ago
parent
commit
d4b08bd62b
4 changed files with 5 additions and 26 deletions
  1. 3 3
      src/server/ua_server.c
  2. 0 3
      src/server/ua_server_internal.h
  3. 0 3
      src/ua_util.c
  4. 2 17
      src/ua_util.h

+ 3 - 3
src/server/ua_server.c

@@ -10,13 +10,13 @@
 /* Namespace Handling */
 /**********************/
 
-void UA_ExternalNamespace_init(UA_ExternalNamespace *ens) {
+static void UA_ExternalNamespace_init(UA_ExternalNamespace *ens) {
 	ens->index = 0;
-    memset(&ens->externalNodeStore, 0, sizeof(UA_ExternalNamespace));
+    memset(&ens->externalNodeStore, 0, sizeof(UA_ExternalNodeStore));
 	UA_String_init(&ens->url);
 }
 
-void UA_ExternalNamespace_deleteMembers(UA_ExternalNamespace *ens) {
+static void UA_ExternalNamespace_deleteMembers(UA_ExternalNamespace *ens) {
 	UA_String_deleteMembers(&ens->url);
     ens->externalNodeStore.delete(ens->externalNodeStore.ensHandle);
 }

+ 0 - 3
src/server/ua_server_internal.h

@@ -14,9 +14,6 @@ typedef struct UA_ExternalNamespace {
 	UA_ExternalNodeStore externalNodeStore;
 } UA_ExternalNamespace;
 
-void UA_ExternalNamespace_init(UA_ExternalNamespace *ens);
-void UA_ExternalNamespace_deleteMembers(UA_ExternalNamespace *ens);
-
 struct UA_Server {
     UA_ApplicationDescription description;
     UA_Int32 endpointDescriptionsSize;

+ 0 - 3
src/ua_util.c

@@ -7,10 +7,7 @@ extern INLINE void UA_memcpy(void *dst, void const *src, UA_Int32 size);
 #ifdef DEBUG
 extern INLINE void _UA_free(void *ptr, char *pname, char *f, UA_Int32 l);
 extern INLINE void * _UA_alloc(UA_Int32 size, char *file, UA_Int32 line);
-extern INLINE void * _UA_alloca(UA_Int32 size, char *file, UA_Int32 line);
-
 #else
 extern INLINE void _UA_free(void *ptr);
 extern INLINE void * _UA_alloc(UA_Int32 size);
-extern INLINE void * _UA_alloca(UA_Int32 size);
 #endif

+ 2 - 17
src/ua_util.h

@@ -81,25 +81,10 @@ INLINE void UA_memcpy(void *dst, void const *src, UA_Int32 size) {
     memcpy(dst, src, size);
 }
 
-#ifdef DEBUG
-#define UA_alloca(size) _UA_alloca(size, __FILE__, __LINE__) 
-INLINE void * _UA_alloca(UA_Int32 size, char *file, UA_Int32 line) {
-	DBG_VERBOSE(printf("UA_alloc - %d;%s;%d\n", size, file, line); fflush(stdout));
-#ifdef WIN32
-	return _alloca(size);
-#else
-	return alloca(size);
-#endif
-}
-#else
-#define UA_alloca(size) _UA_alloca(size) 
-INLINE void * _UA_alloca(UA_Int32 size) {
 #ifdef WIN32
-	return _alloca(size);
+#define UA_alloca(size) _alloca(size)
 #else
-	return alloca(size);
-#endif
-}
+#define UA_alloca(size) alloca(size)
 #endif
 
 #endif /* UA_UTIL_H_ */