[zone] Return the pointer to the global hunk

In trying to reduce unnecessary memsets when loading files, I found that
Hunk_RawAllocName already had nonnull on it, so quakefs needed to know
the hunk it was to use. It seemed much better to to go this way (first
step in what is likely to be a lengthy process) than backtracking a
little and removing the nonnull attribute.
This commit is contained in:
Bill Currie 2021-12-13 09:07:43 +09:00
parent 0a5981878b
commit 39c020908c
2 changed files with 4 additions and 4 deletions

View File

@ -91,8 +91,9 @@
///@{
typedef struct memzone_s memzone_t;
typedef struct memhunk_s memhunk_t;
void Memory_Init (void *buf, size_t size);
memhunk_t *Memory_Init (void *buf, size_t size);
void Z_ClearZone (memzone_t *zone, size_t size, size_t zone_offset,
size_t ele_size);
@ -106,8 +107,6 @@ void Z_SetError (memzone_t *zone, void (*err) (void *data, const char *msg),
void *data);
void Z_CheckPointer (const memzone_t *zone, const void *ptr, size_t size);
typedef struct memhunk_s memhunk_t;
memhunk_t *Hunk_Init (void *buf, size_t size);
void Hunk_Print (memhunk_t *hunk, qboolean all);
void Hunk_Check (memhunk_t *hunk);

View File

@ -1238,9 +1238,10 @@ Hunk_Init (void *buf, size_t size)
return hunk;
}
VISIBLE void
VISIBLE memhunk_t *
Memory_Init (void *buf, size_t size)
{
global_hunk = Hunk_Init (buf, size);
Cache_Init ();
return global_hunk;
}