diff options
author | Jim Blandy <jimb@red-bean.com> | 1999-09-01 02:47:30 +0000 |
---|---|---|
committer | Jim Blandy <jimb@red-bean.com> | 1999-09-01 02:47:30 +0000 |
commit | 078066954951df294c4553b6681e805524153216 (patch) | |
tree | 0acaaad6224e5da0255f8ea7939abe6f7444b180 | |
parent | a4ea22c3d613f31d1c98f5127076460590495813 (diff) | |
download | guile-078066954951df294c4553b6681e805524153216.tar.gz |
Allocators should use the `void *' type for generic pointers.
* gc.c (scm_must_malloc, scm_must_realloc, scm_must_free): Change
argument and return types.
* gc.h: Corresponding changes to prototypes.
(Thanks to Forcer.)
-rw-r--r-- | libguile/gc.c | 21 | ||||
-rw-r--r-- | libguile/gc.h | 6 |
2 files changed, 13 insertions, 14 deletions
diff --git a/libguile/gc.c b/libguile/gc.c index 48396043f..ea28c92d1 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -1428,15 +1428,15 @@ scm_gc_sweep () * * The limit scm_mtrigger may be raised by this allocation. */ -char * +void * scm_must_malloc (scm_sizet size, const char *what) { - char *ptr; + void *ptr; unsigned long nm = scm_mallocated + size; if (nm <= scm_mtrigger) { - SCM_SYSCALL (ptr = (char *) malloc (size)); + SCM_SYSCALL (ptr = malloc (size)); if (NULL != ptr) { scm_mallocated = nm; @@ -1447,7 +1447,7 @@ scm_must_malloc (scm_sizet size, const char *what) scm_igc (what); nm = scm_mallocated + size; - SCM_SYSCALL (ptr = (char *) malloc (size)); + SCM_SYSCALL (ptr = malloc (size)); if (NULL != ptr) { scm_mallocated = nm; @@ -1468,18 +1468,18 @@ scm_must_malloc (scm_sizet size, const char *what) /* scm_must_realloc * is similar to scm_must_malloc. */ -char * -scm_must_realloc (char *where, +void * +scm_must_realloc (void *where, scm_sizet old_size, scm_sizet size, const char *what) { - char *ptr; + void *ptr; scm_sizet nm = scm_mallocated + size - old_size; if (nm <= scm_mtrigger) { - SCM_SYSCALL (ptr = (char *) realloc (where, size)); + SCM_SYSCALL (ptr = realloc (where, size)); if (NULL != ptr) { scm_mallocated = nm; @@ -1490,7 +1490,7 @@ scm_must_realloc (char *where, scm_igc (what); nm = scm_mallocated + size - old_size; - SCM_SYSCALL (ptr = (char *) realloc (where, size)); + SCM_SYSCALL (ptr = realloc (where, size)); if (NULL != ptr) { scm_mallocated = nm; @@ -1508,8 +1508,7 @@ scm_must_realloc (char *where, } void -scm_must_free (obj) - char *obj; +scm_must_free (void *obj) { if (obj) free (obj); diff --git a/libguile/gc.h b/libguile/gc.h index d3c08ce47..ea964beb4 100644 --- a/libguile/gc.h +++ b/libguile/gc.h @@ -94,12 +94,12 @@ extern void scm_gc_mark (SCM p); extern void scm_mark_locations (SCM_STACKITEM x[], scm_sizet n); extern int scm_cellp (SCM value); extern void scm_gc_sweep (void); -extern char * scm_must_malloc (scm_sizet len, const char *what); -extern char * scm_must_realloc (char *where, +extern void * scm_must_malloc (scm_sizet len, const char *what); +extern void * scm_must_realloc (void *where, scm_sizet olen, scm_sizet len, const char *what); extern void scm_done_malloc (long size); -extern void scm_must_free (char *obj); +extern void scm_must_free (void *obj); extern void scm_remember (SCM * ptr); extern SCM scm_return_first (SCM elt, ...); extern SCM scm_permanent_object (SCM obj); |