Allocators should use the `void *' type for generic pointers.
authorJim Blandy <jimb@red-bean.com>
Wed, 1 Sep 1999 02:47:30 +0000 (02:47 +0000)
committerJim Blandy <jimb@red-bean.com>
Wed, 1 Sep 1999 02:47:30 +0000 (02:47 +0000)
* 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.)

libguile/gc.c
libguile/gc.h

index 4839604..ea28c92 100644 (file)
@@ -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);
index d3c08ce..ea964be 100644 (file)
@@ -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);