convert some arena no_zero pushes to zeroed style
This commit is contained in:
parent
57174796b9
commit
2c0b2fcc36
@ -447,10 +447,8 @@ PACK(struct frame_header {
|
||||
INTERNAL void push_error_copy_msg(struct arena *arena, struct ase_error_list *list, struct string msg_src)
|
||||
{
|
||||
logf_error("Error while decoding .ase: \"%F\"", FMT_STR(msg_src));
|
||||
struct ase_error *e = arena_push_no_zero(arena, struct ase_error);
|
||||
*e = (struct ase_error) {
|
||||
.msg = string_copy(arena, msg_src)
|
||||
};
|
||||
struct ase_error *e = arena_push(arena, struct ase_error);
|
||||
e->msg = string_copy(arena, msg_src);
|
||||
if (!list->first) {
|
||||
list->first = e;
|
||||
} else {
|
||||
|
||||
@ -424,14 +424,18 @@ INTERNAL struct epa_result epa_get_normal_from_gjk(struct collider_shape *shape0
|
||||
}
|
||||
}
|
||||
|
||||
/* Insert point into prototype */
|
||||
/* Expand prototype */
|
||||
arena_push_no_zero(scratch.arena, struct collider_menkowski_point);
|
||||
++proto_count;
|
||||
|
||||
/* Shift points in prototype to make room */
|
||||
for (u32 i = proto_count - 1; i > closest_b_index; --i) {
|
||||
u32 shift_from = (i > 0) ? i - 1 : proto_count - 1;
|
||||
u32 shift_to = i;
|
||||
proto[shift_to] = proto[shift_from];
|
||||
}
|
||||
|
||||
/* Insert new point into prototype */
|
||||
proto[closest_b_index] = m;
|
||||
}
|
||||
} else {
|
||||
|
||||
11
src/json.c
11
src/json.c
@ -650,12 +650,11 @@ struct parser {
|
||||
|
||||
INTERNAL void push_error(struct arena *arena, struct parser *p, struct token *t, struct string msg)
|
||||
{
|
||||
struct json_error *error = arena_push_no_zero(arena, struct json_error);
|
||||
*error = (struct json_error) {
|
||||
.msg = msg,
|
||||
.start = t->start,
|
||||
.end = t->end
|
||||
};
|
||||
struct json_error *error = arena_push(arena, struct json_error);
|
||||
error->msg = msg;
|
||||
error->start = t->start;
|
||||
error->end = t->end;
|
||||
|
||||
struct json_error_list *list = &p->errors;
|
||||
if (!list->first) {
|
||||
list->first = error;
|
||||
|
||||
@ -1039,22 +1039,18 @@ void renderer_cmd_buffer_ensure_cmd(struct renderer_cmd_buffer *cmdbuff, struct
|
||||
|| last_cmd->shader->kind != SHADER_TRIANGLE
|
||||
|| (last_cmd->texture.handle != params->texture_params.texture.handle)
|
||||
|| !sprite_tag_eq(last_cmd->sprite, params->texture_params.sprite)) {
|
||||
new_cmd = arena_push_no_zero(&cmdbuff->cpu_cmd_store.arena, struct renderer_cmd);
|
||||
*new_cmd = (struct renderer_cmd) {
|
||||
.shader = &G.shaders[SHADER_TRIANGLE],
|
||||
.texture = params->texture_params.texture,
|
||||
.sprite = params->texture_params.sprite
|
||||
};
|
||||
new_cmd = arena_push(&cmdbuff->cpu_cmd_store.arena, struct renderer_cmd);
|
||||
new_cmd->shader = &G.shaders[SHADER_TRIANGLE];
|
||||
new_cmd->texture = params->texture_params.texture;
|
||||
new_cmd->sprite = params->texture_params.sprite;
|
||||
}
|
||||
} break;
|
||||
|
||||
case SHADER_GRID:
|
||||
{
|
||||
if (!last_cmd || last_cmd->shader->kind != SHADER_GRID) {
|
||||
new_cmd = arena_push_no_zero(&cmdbuff->cpu_cmd_store.arena, struct renderer_cmd);
|
||||
*new_cmd = (struct renderer_cmd) {
|
||||
.shader = &G.shaders[SHADER_GRID],
|
||||
};
|
||||
new_cmd = arena_push(&cmdbuff->cpu_cmd_store.arena, struct renderer_cmd);
|
||||
new_cmd->shader = &G.shaders[SHADER_GRID];
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
@ -125,11 +125,10 @@ INTERNAL WORK_TASK_FUNC_DEF(sound_load_asset_task, vparams)
|
||||
}
|
||||
|
||||
/* Initialize */
|
||||
*sound = (struct sound) {
|
||||
.flags = flags,
|
||||
.pcm.count = decoded.pcm.count,
|
||||
.pcm.samples = samples
|
||||
};
|
||||
MEMZERO_STRUCT(sound);
|
||||
sound->flags = flags;
|
||||
sound->pcm.count = decoded.pcm.count;
|
||||
sound->pcm.samples = samples;
|
||||
MEMCPY(sound->pcm.samples, decoded.pcm.samples, decoded.pcm.count * sizeof(*decoded.pcm.samples));
|
||||
|
||||
f64 elapsed = SECONDS_FROM_NS(sys_time_ns() - start_ns);
|
||||
|
||||
@ -369,7 +369,7 @@ INTERNAL void cache_entry_load_texture(struct cache_ref ref, struct sprite_tag t
|
||||
resource_close(&texture_rs);
|
||||
|
||||
/* Initialize */
|
||||
e->texture = arena_push_no_zero(&e->arena, struct sprite_texture);
|
||||
e->texture = arena_push(&e->arena, struct sprite_texture);
|
||||
e->texture->width = decoded.image.width;
|
||||
e->texture->height = decoded.image.height;
|
||||
e->texture->texture = renderer_texture_alloc(RENDERER_TEXTURE_FORMAT_R8G8B8A8_UNORM, 0, V2I32(decoded.image.width, decoded.image.height), decoded.image.pixels);
|
||||
|
||||
10
src/tar.c
10
src/tar.c
@ -119,12 +119,10 @@ struct tar_archive tar_parse(struct arena *arena, struct string data, struct str
|
||||
}
|
||||
struct string file_name = string_cat(arena, prefix, file_name_cstr);
|
||||
|
||||
struct tar_entry *entry = arena_push_no_zero(arena, struct tar_entry);
|
||||
*entry = (struct tar_entry) {
|
||||
.is_dir = is_dir,
|
||||
.file_name = file_name,
|
||||
.data = file_data
|
||||
};
|
||||
struct tar_entry *entry = arena_push(arena, struct tar_entry);
|
||||
entry->is_dir = is_dir;
|
||||
entry->file_name = file_name;
|
||||
entry->data = file_data;
|
||||
|
||||
entry->next = archive.head;
|
||||
archive.head = entry;
|
||||
|
||||
@ -152,7 +152,7 @@ INLINE void fixed_dict_set(struct arena *arena, struct fixed_dict *dict, struct
|
||||
}
|
||||
|
||||
/* No match found, create new entry */
|
||||
entry = arena_push_no_zero(arena, struct fixed_dict_entry);
|
||||
entry = arena_push(arena, struct fixed_dict_entry);
|
||||
entry->key = key;
|
||||
entry->value = value;
|
||||
entry->hash = hash;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user