summaryrefslogtreecommitdiff
path: root/source/base
diff options
context:
space:
mode:
Diffstat (limited to 'source/base')
-rw-r--r--source/base/base_os.h3
-rw-r--r--source/base/base_string.h12
2 files changed, 10 insertions, 5 deletions
diff --git a/source/base/base_os.h b/source/base/base_os.h
index 4f84d93..4357214 100644
--- a/source/base/base_os.h
+++ b/source/base/base_os.h
@@ -23,7 +23,7 @@ load_file(mem_arena *arena, const char *path)
23 } 23 }
24 24
25 25
26 result = PushString(arena, sbuf.st_size); 26 result = PushString8(arena, sbuf.st_size);
27 27
28 result.size = (u64)sbuf.st_size; 28 result.size = (u64)sbuf.st_size;
29 if(result.size != 0) 29 if(result.size != 0)
@@ -38,7 +38,6 @@ load_file(mem_arena *arena, const char *path)
38internal string8 38internal string8
39write_file(const char *path, string8 data) 39write_file(const char *path, string8 data)
40{ 40{
41
42 string8 result = {0}; 41 string8 result = {0};
43 s32 file = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); 42 s32 file = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
44 if(file == -1) 43 if(file == -1)
diff --git a/source/base/base_string.h b/source/base/base_string.h
index c4b9f94..eb51e65 100644
--- a/source/base/base_string.h
+++ b/source/base/base_string.h
@@ -1,9 +1,15 @@
1#ifndef BASE_STRING_H 1#ifndef BASE_STRING_H
2#define BASE_STRING_H 2#define BASE_STRING_H
3 3
4#define PushString(arena, count) (string8){ .data = (PushArrayZero(arena, u8, (count))), .size = (count) } 4#define PushString8(arena, count) (string8){ .data = (PushArrayZero(arena, u8, (count))), .size = (count) }
5#define StringCast(data, size) (string8){(u8 *)(data), (u64)(size) } 5#define PushString16(arena, count) (string16){ .data = (PushArrayZero(arena, u16, (count))), .size = (count) }
6#define StringPCast(data, size) (string8 *){(u8 *)(data), (u64)(size) } 6#define PushString32(arena, count) (string32){ .data = (PushArrayZero(arena, u32, (count))), .size = (count) }
7
8#define String8(data, size) (string8){(u8 *)(data), (u64)(size) }
9#define String16(data, size) (string16){(u16 *)(data), (u64)(size) }
10#define String32(data, size) (string32){(u32 *)(data), (u64)(size) }
11
12
7 13
8#define StringFmt "%.*s" 14#define StringFmt "%.*s"
9#define ULongFmt "%lu" 15#define ULongFmt "%lu"