-#ifndef _BABELTRACE_UUID_H
-#define _BABELTRACE_UUID_H
+#ifndef _BABELTRACE_COMPAT_UUID_H
+#define _BABELTRACE_COMPAT_UUID_H
/*
- * babeltrace/uuid.h
+ * babeltrace/compat/uuid.h
*
* Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* SOFTWARE.
*/
-#include <config.h>
-
/* Includes final \0. */
#define BABELTRACE_UUID_STR_LEN 37
#define BABELTRACE_UUID_LEN 16
#include <uuid/uuid.h>
static inline
-int babeltrace_uuid_generate(unsigned char *uuid_out)
+int bt_uuid_generate(unsigned char *uuid_out)
{
uuid_generate(uuid_out);
return 0;
}
+/* Sun's libuuid lacks const qualifiers */
+#if defined(__sun__)
+static inline
+int bt_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+{
+ uuid_unparse((unsigned char *) uuid_in, str_out);
+ return 0;
+}
+
+static inline
+int bt_uuid_parse(const char *str_in, unsigned char *uuid_out)
+{
+ return uuid_parse((char *) str_in, uuid_out);
+}
+
static inline
-int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+int bt_uuid_compare(const unsigned char *uuid_a,
+ const unsigned char *uuid_b)
+{
+ return uuid_compare((unsigned char *) uuid_a,
+ (unsigned char *) uuid_b);
+}
+#else
+static inline
+int bt_uuid_unparse(const unsigned char *uuid_in, char *str_out)
{
uuid_unparse(uuid_in, str_out);
return 0;
}
static inline
-int babeltrace_uuid_parse(const char *str_in, unsigned char *uuid_out)
+int bt_uuid_parse(const char *str_in, unsigned char *uuid_out)
{
return uuid_parse(str_in, uuid_out);
}
static inline
-int babeltrace_uuid_compare(const unsigned char *uuid_a,
+int bt_uuid_compare(const unsigned char *uuid_a,
const unsigned char *uuid_b)
{
return uuid_compare(uuid_a, uuid_b);
}
+#endif
#elif defined(BABELTRACE_HAVE_LIBC_UUID)
#include <uuid.h>
#include <stdlib.h>
static inline
-int babeltrace_uuid_generate(unsigned char *uuid_out)
+int bt_uuid_generate(unsigned char *uuid_out)
{
uint32_t status;
}
static inline
-int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+int bt_uuid_unparse(const unsigned char *uuid_in, char *str_out)
{
uint32_t status;
char *alloc_str;
}
static inline
-int babeltrace_uuid_parse(const char *str_in, unsigned char *uuid_out)
+int bt_uuid_parse(const char *str_in, unsigned char *uuid_out)
{
uint32_t status;
}
static inline
-int babeltrace_uuid_compare(const unsigned char *uuid_a,
+int bt_uuid_compare(const unsigned char *uuid_a,
const unsigned char *uuid_b)
{
uint32_t status;
return -1;
}
+#elif defined(__MINGW32__)
+
+int bt_uuid_generate(unsigned char *uuid_out);
+int bt_uuid_unparse(const unsigned char *uuid_in, char *str_out);
+int bt_uuid_parse(const char *str_in, unsigned char *uuid_out);
+int bt_uuid_compare(const unsigned char *uuid_a,
+ const unsigned char *uuid_b);
+
#else
#error "Babeltrace needs to have a UUID generator configured."
#endif
-#endif /* _BABELTRACE_UUID_H */
+#endif /* _BABELTRACE_COMPAT_UUID_H */