Add labels to all typedef'd structs and enums
Release / release (push) Successful in 4s

This commit is contained in:
2026-09-13 02:31:46 +01:00
parent 5df1a105c7
commit 575e0a52b1
20 changed files with 74 additions and 26 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ typedef uptr *WpUptrArray;
typedef iptr *WpIptrArray;
typedef WpStr8 *WpStr8Array;
typedef enum {
typedef enum WpArrayInitFlags {
WP_ARRAY_INIT_NONE = 0,
WP_ARRAY_INIT_FILLED = 1 << 1,
} WpArrayInitFlags;
+2 -2
View File
@@ -16,7 +16,7 @@ BEGIN_C_LINKAGE
typedef struct WpDblNode WpDblNode;
typedef struct {
typedef struct WpDblNodeHeader {
u64 magic;
u64 item_size;
WpDblNode *prev;
@@ -28,7 +28,7 @@ struct WpDblNode {
void *item;
};
typedef struct {
typedef struct WpDblList {
u64 magic;
u64 node_count;
u64 item_size;
+44
View File
@@ -0,0 +1,44 @@
// vim:fileencoding=utf-8:foldmethod=marker
#include "hasher.h"
#include "../../../common/assert/assert.h"
WpU128Hash wpHasherGetHash128(const WpHasher *hasher, WpU8Stream *stream, void *hasher_data) {
wpDebugAssert(hasher != NULL && stream != NULL, "hasher and stream shouldn't be NULL");
WpU128Hash output;
switch (hasher->type) {
case WP_HASH_TYPE_64: {
output.hash[0] = hasher->hasher_64(stream, hasher_data);
output.hash[1] = hasher->hasher_64(stream, hasher_data);
} break;
case WP_HASH_TYPE_128: {
output = hasher->hasher_128(stream, hasher_data);
} break;
default: {
wpRuntimeAssert(0, "Invalid hasher type");
} break;
}
return output;
}
u64 wpHasherGetHash64(const WpHasher *hasher, WpU8Stream *stream, void *hasher_data) {
wpDebugAssert(hasher != NULL && stream != NULL, "hasher and stream shouldn't be NULL");
u64 output;
switch (hasher->type) {
case WP_HASH_TYPE_64: {
output = hasher->hasher_64(stream, hasher_data);
} break;
case WP_HASH_TYPE_128: {
WpU128Hash hash = hasher->hasher_128(stream, hasher_data);
output = hash.hash[0] ^ hash.hash[1];
} break;
default: {
wpRuntimeAssert(0, "Invalid hasher type");
} break;
}
return output;
}
+6 -3
View File
@@ -9,11 +9,11 @@
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
typedef struct {
typedef struct WpU128Hash {
u64 hash[2];
} WpU128Hash;
typedef enum {
typedef enum WpHasherType {
WP_HASH_TYPE_64,
WP_HASH_TYPE_128,
@@ -23,7 +23,7 @@ typedef enum {
typedef u64 (*WpHasher64) (WpU8Stream *stream, void *hasher_data);
typedef WpU128Hash (*WpHasher128)(WpU8Stream *stream, void *hasher_data);
typedef struct {
typedef struct WpHasher {
WpHasherType type;
union {
WpHasher64 hasher_64;
@@ -39,6 +39,9 @@ typedef struct {
#define wpHasher128(HASHER) ((WpHasher){ .type = WP_HASH_TYPE_128, .hasher_128 = (HASHER) })
#endif
WpU128Hash wpHasherGetHash128(const WpHasher *hasher, WpU8Stream *stream, void *hasher_data);
u64 wpHasherGetHash64 (const WpHasher *hasher, WpU8Stream *stream, void *hasher_data);
#ifdef WP_PLATFORM_CPP
END_C_LINKAGE
#endif // !WP_PLATFORM_CPP
+1 -1
View File
@@ -19,7 +19,7 @@ BEGIN_C_LINKAGE
#define WP_MUR3_HASHER_MAGIC wpU64Const(0x57504d4841534833)
typedef struct {
typedef struct WpMur3HasherData {
u64 magic;
u32 seed;
} WpMur3HasherData;
+2 -2
View File
@@ -19,12 +19,12 @@ BEGIN_C_LINKAGE
#define WP_SIP_HASHER_MAGIC wpU64Const(0x5750534950485348)
typedef struct {
typedef struct WpSipHasherKey {
u64 lo;
u64 hi;
} WpSipHasherKey;
typedef struct {
typedef struct WpSipHasherData {
WpSipHasherKey key;
u64 magic;
u64 compression;
+1 -1
View File
@@ -11,7 +11,7 @@
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
typedef enum {
typedef enum WpMemOp {
WP_MEM_OP_ALLOC,
WP_MEM_OP_ALLOC_ALIGNED,
WP_MEM_OP_REALLOC,
+1 -1
View File
@@ -12,7 +12,7 @@
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
typedef struct {
typedef struct WpQueue {
WpArray items;
u64 front;
u64 back;
+1 -1
View File
@@ -10,7 +10,7 @@
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
typedef struct {
typedef struct WpStream {
void *data;
u64 count;
u64 position;
+1
View File
@@ -6,6 +6,7 @@
#include "wapp_base.h"
#include "array/array.c"
#include "dbl_list/dbl_list.c"
#include "hash/hasher/hasher.c"
#include "hash/hasher/murmur3.c"
#include "hash/hasher/siphash.c"
#include "queue/queue.c"
+1 -1
View File
@@ -15,7 +15,7 @@ wp_intern WpStr8RO L_BRACKET = wpStr8LitRo("[");
wp_intern WpStr8RO R_BRACKET_SPACE = wpStr8LitRo("] ");
wp_intern WpStr8RO R_BRACKET_NEWLINE = wpStr8LitRo("]\n");
typedef struct {
typedef struct LogConfig {
WpFile *outlog;
WpFile *errlog;
WpLogLevel level;
+2 -2
View File
@@ -10,7 +10,7 @@
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
typedef enum {
typedef enum WpLogLevel {
WP_LOG_LEVEL_FATAL,
WP_LOG_LEVEL_CRITICAL,
WP_LOG_LEVEL_ERROR,
@@ -21,7 +21,7 @@ typedef enum {
COUNT_LOG_LEVEL,
} WpLogLevel;
typedef struct {
typedef struct WpLogger {
WpStr8 name;
} WpLogger;
+1 -1
View File
@@ -16,7 +16,7 @@
#define ARENA_MINIMUM_CAPACITY KiB(16) // Allocate minimum of 4 pages
typedef enum {
typedef enum WpCpathJoinResult {
ARENA_STORAGE_TYPE_ALLOCATED,
ARENA_STORAGE_TYPE_BUFFER,
} ArenaStorageType;
+1 -1
View File
@@ -28,7 +28,7 @@ BEGIN_C_LINKAGE
#define wpCpathDirname(ALLOCATOR, PATH) dirUp(ALLOCATOR, PATH, 1)
#define wpCpathDirUp(ALLOCATOR, PATH, COUNT) dirUp(ALLOCATOR, PATH, COUNT)
typedef enum {
typedef enum WpCpathJoinResult {
WP_CPATH_JOIN_RESULT_SUCCESS = 0,
WP_CPATH_JOIN_RESULT_INVALID_ARGS,
WP_CPATH_JOIN_RESULT_EMPTY_PARTS,
+2 -2
View File
@@ -13,7 +13,7 @@ BEGIN_C_LINKAGE
typedef struct WpFile WpFile;
typedef enum {
typedef enum WpFileAccessMode {
WP_ACCESS_READ, // Equivalent to r
WP_ACCESS_WRITE, // Equivalent to w
WP_ACCESS_APPEND, // Equivalent to a
@@ -26,7 +26,7 @@ typedef enum {
COUNT_FILE_ACCESS_MODE,
} WpFileAccessMode;
typedef enum {
typedef enum WpFileSeekOrigin {
WP_SEEK_START,
WP_SEEK_CURRENT,
WP_SEEK_END,
+2 -2
View File
@@ -9,7 +9,7 @@
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
typedef enum {
typedef enum WpMemAccess {
WP_MEM_ACCESS_NONE,
WP_MEM_ACCESS_READ_ONLY,
WP_MEM_ACCESS_EXEC_ONLY,
@@ -18,7 +18,7 @@ typedef enum {
WP_MEM_ACCESS_READ_WRITE_EXEC,
} WpMemAccess;
typedef enum {
typedef enum WpMemInitType {
WP_MEM_INIT_UNINITIALISED,
WP_MEM_INIT_INITIALISED,
} WpMemInitType;
+1 -1
View File
@@ -13,7 +13,7 @@ BEGIN_C_LINKAGE
#include <sys/mman.h>
typedef enum {
typedef enum WpMemAllocFlags {
#if defined(WP_PLATFORM_LINUX) || defined(WP_PLATFORM_GNU)
WP_MEM_ALLOC_RESERVE = 0,
WP_MEM_ALLOC_COMMIT = MAP_POPULATE,
+1 -1
View File
@@ -15,7 +15,7 @@ BEGIN_C_LINKAGE
#include <Windows.h>
#include <memoryapi.h>
typedef enum {
typedef enum WpMemAllocFlags {
WP_MEM_ALLOC_RESERVE = MEM_RESERVE,
WP_MEM_ALLOC_COMMIT = MEM_COMMIT,
} WpMemAllocFlags;
+2 -2
View File
@@ -11,13 +11,13 @@
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
typedef enum {
typedef enum WpCmdOutHandling {
WP_SHELL_OUTPUT_DISCARD,
WP_SHELL_OUTPUT_PRINT,
WP_SHELL_OUTPUT_CAPTURE,
} WpCmdOutHandling;
typedef enum {
typedef enum WpCmdError {
WP_SHELL_ERR_NO_ERROR,
WP_SHELL_ERR_INVALID_ARGS,
WP_SHELL_ERR_ALLOCATION_FAIL,
+1 -1
View File
@@ -10,7 +10,7 @@
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
typedef enum {
typedef enum WpTerminalColour {
WP_TERM_COLOUR_FG_BLACK,
WP_TERM_COLOUR_FG_RED,
WP_TERM_COLOUR_FG_GREEN,