Standardize naming conventions #12
+3
-3
@@ -16,9 +16,9 @@ struct UUID4 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
wp_intern UUID4 generate_uuid4(void);
|
wp_intern UUID4 generate_uuid4(void);
|
||||||
wp_intern void uuid4_to_uuid(const UUID4* uuid4, WUUID *uuid);
|
wp_intern void uuid4_to_uuid(const UUID4* uuid4, WpUuid *uuid);
|
||||||
|
|
||||||
WUUID *wapp_uuid_init_uuid4(WUUID *uuid) {
|
WpUuid *wpUuidInitUuid4(WpUuid *uuid) {
|
||||||
wpDebugAssert(uuid != NULL, "`uuid` should not be NULL");
|
wpDebugAssert(uuid != NULL, "`uuid` should not be NULL");
|
||||||
|
|
||||||
UUID4 uuid4 = generate_uuid4();
|
UUID4 uuid4 = generate_uuid4();
|
||||||
@@ -47,7 +47,7 @@ wp_intern UUID4 generate_uuid4(void) {
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_intern void uuid4_to_uuid(const UUID4* uuid4, WUUID *uuid) {
|
wp_intern void uuid4_to_uuid(const UUID4* uuid4, WpUuid *uuid) {
|
||||||
u64 group1 = uuid4->high >> 32;
|
u64 group1 = uuid4->high >> 32;
|
||||||
u64 group2 = (uuid4->high << 32) >> 48;
|
u64 group2 = (uuid4->high << 32) >> 48;
|
||||||
u64 group3 = (uuid4->high << 48) >> 48;
|
u64 group3 = (uuid4->high << 48) >> 48;
|
||||||
|
|||||||
+12
-12
@@ -11,37 +11,37 @@
|
|||||||
BEGIN_C_LINKAGE
|
BEGIN_C_LINKAGE
|
||||||
#endif // !WP_PLATFORM_CPP
|
#endif // !WP_PLATFORM_CPP
|
||||||
|
|
||||||
#define UUID_BUF_LENGTH 48
|
#define WP_UUID_BUF_LENGTH 48
|
||||||
#define WAPP_UUID_SPEC WAPP_STR8_SPEC
|
#define WP_UUID_SPEC WAPP_STR8_SPEC
|
||||||
#define wapp_uuid_varg(WUUID) wapp_str8_varg((WUUID).uuid)
|
#define wpUuidVarg(WpUuid) wapp_str8_varg((WpUuid).uuid)
|
||||||
|
|
||||||
typedef struct WUUID WUUID;
|
typedef struct WpUuid WpUuid;
|
||||||
struct WUUID {
|
struct WpUuid {
|
||||||
Str8 uuid;
|
Str8 uuid;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO (Abdelrahman): Update UUID implementation to work properly with C++ and tests for validation
|
// TODO (Abdelrahman): Update UUID implementation to work properly with C++ and tests for validation
|
||||||
|
|
||||||
#ifdef WP_PLATFORM_CPP
|
#ifdef WP_PLATFORM_CPP
|
||||||
#define wapp_uuid_gen_uuid4() ([&](){ \
|
#define wpUuidGenUuid4() ([&](){ \
|
||||||
wp_persist WUUID uuid = wapp_uuid_create(); \
|
wp_persist WpUuid uuid = wpUuidCreate(); \
|
||||||
return *(wapp_uuid_init_uuid4(&uuid)); \
|
return *(wpUuidInitUuid4(&uuid)); \
|
||||||
}())
|
}())
|
||||||
#else
|
#else
|
||||||
#define wapp_uuid_gen_uuid4() *(wapp_uuid_init_uuid4(&wapp_uuid_create()))
|
#define wpUuidGenUuid4() *(wpUuidInitUuid4(&wpUuidCreate()))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Low level UUID API */
|
/* Low level UUID API */
|
||||||
|
|
||||||
#ifdef WP_PLATFORM_CPP
|
#ifdef WP_PLATFORM_CPP
|
||||||
#define wapp_uuid_create() ([&](){ return WUUID{wapp_str8_buf(UUID_BUF_LENGTH)}; }())
|
#define wpUuidCreate() ([&](){ return WpUuid{wapp_str8_buf(WP_UUID_BUF_LENGTH)}; }())
|
||||||
#else
|
#else
|
||||||
#define wapp_uuid_create() ((WUUID){.uuid = wapp_str8_buf(UUID_BUF_LENGTH)})
|
#define wpUuidCreate() ((WpUuid){.uuid = wapp_str8_buf(WP_UUID_BUF_LENGTH)})
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Just returns the same pointer that was passed in with the UUID initialised.
|
// Just returns the same pointer that was passed in with the UUID initialised.
|
||||||
// Fails when passed a NULL pointer.
|
// Fails when passed a NULL pointer.
|
||||||
WUUID *wapp_uuid_init_uuid4(WUUID *uuid);
|
WpUuid *wpUuidInitUuid4(WpUuid *uuid);
|
||||||
|
|
||||||
#ifdef WP_PLATFORM_CPP
|
#ifdef WP_PLATFORM_CPP
|
||||||
END_C_LINKAGE
|
END_C_LINKAGE
|
||||||
|
|||||||
Reference in New Issue
Block a user