Skip to content

Commit

Permalink
Issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodan58 committed Apr 10, 2024
1 parent 2ca0244 commit 2d77fe8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
17 changes: 9 additions & 8 deletions gc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
module : gc.c
version : 1.40
date : 02/12/24
version : 1.43
date : 04/10/24
*/
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -156,7 +156,7 @@ static void mem_exit(void)
/*
Initialise gc memory.
*/
void GC_INIT()
void GC_INIT(void)
{
#ifdef SCAN_BSS_MEMORY
init_heap();
Expand Down Expand Up @@ -296,7 +296,7 @@ static void remind(char *ptr, size_t size, int flags)
*/
static void *mem_block(size_t size, int f)
{
void *ptr;
void *ptr = 0;

if (size > MAX_SIZE || (ptr = malloc(size)) == 0)
mem_fatal();
Expand Down Expand Up @@ -329,13 +329,15 @@ void *GC_malloc(size_t size)
Update the size of a memory block.
*/
#ifdef USE_GC_REALLOC
#if 0
static void update(void *ptr, size_t size)
{
khiter_t key;

if ((key = kh_get(Backup, MEM, (uint64_t)ptr)) != kh_end(MEM))
kh_value(MEM, key).size = size;
}
#endif

/*
Forget about a memory block and return its flags.
Expand All @@ -358,15 +360,14 @@ static unsigned char forget(void *ptr)
void *GC_realloc(void *old, size_t size)
{
void *ptr;
unsigned char flags;

if (!old)
return GC_malloc(size);
flags = forget(old);
if ((ptr = realloc(old, size)) == 0)
mem_fatal();
if (ptr == old)
update(ptr, size);
else
remind(ptr, size, forget(old));
remind(ptr, size, flags);
return ptr;
}
#endif
Expand Down
6 changes: 0 additions & 6 deletions test2/system.joy

This file was deleted.

0 comments on commit 2d77fe8

Please sign in to comment.