Skip to content

Commit

Permalink
Rename arena_destroy() to arena_reset()
Browse files Browse the repository at this point in the history
This function might free memory and whatnot, but it leaves the arena
object in a usable state, so the "reset" terminology is more
appropriate.
  • Loading branch information
lpereira committed Aug 19, 2024
1 parent dc8e0f0 commit 9509197
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/lib/lwan-arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void arena_init(struct arena *a)
a->bump_ptr_alloc.remaining = 0;
}

void arena_destroy(struct arena *a)
void arena_reset(struct arena *a)
{
void **iter;

Expand Down Expand Up @@ -77,10 +77,10 @@ void *arena_alloc(struct arena *a, size_t sz)
return arena_bump_ptr(a, sz);
}

static void destroy_arena(void *data)
static void reset_arena(void *data)
{
struct arena *arena = data;
arena_destroy(arena);
arena_reset(arena);
}

struct arena *coro_arena_new(struct coro *coro)
Expand All @@ -89,7 +89,7 @@ struct arena *coro_arena_new(struct coro *coro)

if (LIKELY(arena)) {
arena_init(arena);
coro_defer(coro, destroy_arena, arena);
coro_defer(coro, reset_arena, arena);
}

return arena;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/lwan-arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ struct arena {

void arena_init(struct arena *a);
struct arena *coro_arena_new(struct coro *coro);
void arena_destroy(struct arena *a);
void arena_reset(struct arena *a);

void *arena_alloc(struct arena *a, size_t sz);
2 changes: 1 addition & 1 deletion src/lib/lwan-mod-fastcgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ static bool build_stdin_records(struct lwan_request *request,
return false;
}
iovec_array_reset(iovec_array);
arena_destroy(arena);
arena_reset(arena);
}

to_send -= block_size;
Expand Down

0 comments on commit 9509197

Please sign in to comment.