Commit: 1a66af3fd7dbf7f8bd157a841cfba85c13367537
Parent: d3cfaa359b247baae041f266ecdb03d3874da76c
Author: Randy Palamar
Date: Fri, 2 May 2025 08:31:42 -0600
util: make default s8 empty not 0
Diffstat:
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/beamformer.c b/beamformer.c
@@ -458,7 +458,7 @@ reload_compute_shader(BeamformerCtx *ctx, s8 path, s8 extra, ComputeShaderReload
Stream sb = arena_stream(tmp);
stream_append_s8s(&sb, path, extra);
s8 info = arena_stream_commit(&tmp, &sb);
- u32 new_program = load_shader(&ctx->os, tmp, 1, (s8){0}, (s8){0}, shader_text,
+ u32 new_program = load_shader(&ctx->os, tmp, 1, s8(""), s8(""), shader_text,
info, csr->label);
if (new_program) {
glDeleteProgram(cs->programs[csr->shader]);
diff --git a/os_linux.c b/os_linux.c
@@ -92,9 +92,9 @@ static OS_OPEN_FOR_WRITE_FN(os_open_for_write)
return result;
}
-static OS_READ_WHOLE_FILE_FN(os_read_whole_file)
+function OS_READ_WHOLE_FILE_FN(os_read_whole_file)
{
- s8 result = {0};
+ s8 result = s8("");
struct stat sb;
i32 fd = open(file, O_RDONLY);
@@ -102,7 +102,7 @@ static OS_READ_WHOLE_FILE_FN(os_read_whole_file)
result = s8_alloc(arena, sb.st_size);
iz rlen = read(fd, result.data, result.len);
if (rlen != result.len)
- result = (s8){0};
+ result = s8("");
}
if (fd >= 0) close(fd);
diff --git a/os_win32.c b/os_win32.c
@@ -190,9 +190,9 @@ static OS_OPEN_FOR_WRITE_FN(os_open_for_write)
return result;
}
-static OS_READ_WHOLE_FILE_FN(os_read_whole_file)
+function OS_READ_WHOLE_FILE_FN(os_read_whole_file)
{
- s8 result = {0};
+ s8 result = s8("");
w32_file_info fileinfo;
iptr h = CreateFileA(file, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
@@ -205,7 +205,7 @@ static OS_READ_WHOLE_FILE_FN(os_read_whole_file)
i32 rlen;
if (!ReadFile(h, result.data, result.len, &rlen, 0) || rlen != result.len)
- result = (s8){0};
+ result = s8("");
}
if (h >= 0) CloseHandle(h);
diff --git a/static.c b/static.c
@@ -46,7 +46,7 @@ static void
debug_init(OS *os, iptr input, Arena *arena)
{
os->add_file_watch(os, arena, s8(OS_DEBUG_LIB_NAME), debug_reload, input);
- debug_reload(os, (s8){0}, input, *arena);
+ debug_reload(os, s8(""), input, *arena);
Stream err = arena_stream(*arena);
void *rdoc = os_get_module(OS_RENDERDOC_SONAME, 0);
@@ -212,7 +212,7 @@ function FILE_WATCH_CALLBACK_FN(reload_render_shader)
fragment.data -= header.len;
fragment.len += header.len;
ASSERT(fragment.data == header.data);
- u32 new_program = load_shader(os, tmp, 0, vertex, fragment, (s8){0}, path, s8("Render Shader"));
+ u32 new_program = load_shader(os, tmp, 0, vertex, fragment, s8(""), path, s8("Render Shader"));
if (new_program) {
glDeleteProgram(ctx->shader);
ctx->shader = new_program;
diff --git a/util.c b/util.c
@@ -215,7 +215,7 @@ stream_alloc(Arena *a, iz cap)
function s8
stream_to_s8(Stream *s)
{
- s8 result = {0};
+ s8 result = s8("");
if (!s->errors) result = (s8){.len = s->widx, .data = s->data};
return result;
}
@@ -462,7 +462,7 @@ s8_alloc(Arena *a, iz len)
static s8
s16_to_s8(Arena *a, s16 in)
{
- s8 result = {0};
+ s8 result = s8("");
if (in.len) {
iz commit = in.len * 4;
iz length = 0;