FreeBSD uuid wrapper fixes
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 1 Mar 2012 23:15:38 +0000 (18:15 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 1 Mar 2012 23:15:38 +0000 (18:15 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/babeltrace/ctf/metadata.h
include/babeltrace/uuid.h

index f283fe700e0fa3f299207464ceb5b0ebc28db691..de8a1a8e62f5798d943be2749de42189b617f432 100644 (file)
@@ -25,7 +25,6 @@
 #include <babeltrace/ctf-ir/metadata.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <babeltrace/ctf-ir/metadata.h>
 #include <sys/types.h>
 #include <dirent.h>
-#include <uuid/uuid.h>
 #include <assert.h>
 #include <glib.h>
 
 #include <assert.h>
 #include <glib.h>
 
index dfe1e020646ce6c6b24069813d37a932d399e90f..3404ed437838a27c1b8c51f31d524dc3ab8d6c4e 100644 (file)
@@ -31,9 +31,10 @@ int babeltrace_uuid_generate(unsigned char *uuid_out)
 }
 
 static inline
 }
 
 static inline
-void babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
 {
 {
-       return uuid_unparse(uuid_in, str_out);
+       uuid_unparse(uuid_in, str_out);
+       return 0;
 }
 
 static inline
 }
 
 static inline
@@ -52,6 +53,8 @@ int babeltrace_uuid_compare(const unsigned char *uuid_a,
 #elif defined(BABELTRACE_HAVE_LIBC_UUID)
 #include <uuid.h>
 #include <stdint.h>
 #elif defined(BABELTRACE_HAVE_LIBC_UUID)
 #include <uuid.h>
 #include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
 
 static inline
 int babeltrace_uuid_generate(unsigned char *uuid_out)
 
 static inline
 int babeltrace_uuid_generate(unsigned char *uuid_out)
@@ -66,15 +69,21 @@ int babeltrace_uuid_generate(unsigned char *uuid_out)
 }
 
 static inline
 }
 
 static inline
-void babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
 {
        uint32_t status;
 {
        uint32_t status;
-
-       uuid_to_string((uuid_t *) uuid_in, str_out, &status);
-       if (status == uuid_s_ok)
-               return 0;
-       else
-               return -1;
+       char *alloc_str;
+       int ret;
+
+       uuid_to_string((uuid_t *) uuid_in, &alloc_str, &status);
+       if (status == uuid_s_ok) {
+               strcpy(str_out, alloc_str);
+               ret = 0;
+       } else {
+               ret = -1;
+       }
+       free(alloc_str);
+       return ret;
 }
 
 static inline
 }
 
 static inline
This page took 0.026313 seconds and 4 git commands to generate.