summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1b1d76c)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
#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 <assert.h>
#include <glib.h>
#include <assert.h>
#include <glib.h>
-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;
#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)
-void babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
-
- 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;