]> granicus.if.org Git - gc/commitdiff
Fix (adjust) GC_scratch_alloc actual argument type
authorIvan Maidanski <ivmai@mail.ru>
Tue, 20 Dec 2016 07:21:07 +0000 (10:21 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 6 Feb 2017 18:56:39 +0000 (21:56 +0300)
* dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX]
(GC_register_dynamic_libraries): Do not cast GC_scratch_alloc argument
to word type (it should be of size_t).
* headers.c (alloc_hdr, GC_init_headers, get_index): Likewise.
* os_dep.c [PROC_VDB] (GC_proc_buf_size): Change type from word to size_t.
* os_dep.c [PROC_VDB] (GC_read_dirty): Change type of new_size local
variable (which is passed to GC_scratch_alloc) from word to size_t.

dyn_load.c
headers.c
os_dep.c

index 823eb31922321f6dea64fd96db12f571d025f75e..79614bf14cc51019caeadca434b50fbb63be5438 100644 (file)
@@ -813,7 +813,7 @@ GC_INNER void GC_register_dynamic_libraries(void)
         current_sz = needed_sz * 2 + 1;
                         /* Expansion, plus room for 0 record */
         addr_map = (prmap_t *)GC_scratch_alloc(
-                                (word)current_sz * sizeof(prmap_t));
+                                (size_t)current_sz * sizeof(prmap_t));
         if (addr_map == NULL)
           ABORT("Insufficient memory for address map");
     }
index 108adf18b7d71975868876d96727a3955f6598bc..964edcad18bba3f230d761fe35c89a3f348f58bc 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -165,7 +165,7 @@ static hdr * alloc_hdr(void)
     register hdr * result;
 
     if (hdr_free_list == 0) {
-        result = (hdr *) GC_scratch_alloc((word)(sizeof(hdr)));
+        result = (hdr *)GC_scratch_alloc(sizeof(hdr));
     } else {
         result = hdr_free_list;
         hdr_free_list = (hdr *) (result -> hb_next);
@@ -189,7 +189,7 @@ GC_INNER void GC_init_headers(void)
 {
     register unsigned i;
 
-    GC_all_nils = (bottom_index *)GC_scratch_alloc((word)sizeof(bottom_index));
+    GC_all_nils = (bottom_index *)GC_scratch_alloc(sizeof(bottom_index));
     if (GC_all_nils == NULL) {
       GC_err_printf("Insufficient memory for GC_all_nils\n");
       EXIT();
@@ -219,14 +219,14 @@ static GC_bool get_index(word addr)
           if (p -> key == hi) return(TRUE);
           p = p -> hash_link;
       }
-      r = (bottom_index*)GC_scratch_alloc((word)(sizeof (bottom_index)));
+      r = (bottom_index *)GC_scratch_alloc(sizeof(bottom_index));
       if (r == 0) return(FALSE);
       BZERO(r, sizeof (bottom_index));
       r -> hash_link = old;
       GC_top_index[i] = r;
 #   else
       if (GC_top_index[hi] != GC_all_nils) return(TRUE);
-      r = (bottom_index*)GC_scratch_alloc((word)(sizeof (bottom_index)));
+      r = (bottom_index *)GC_scratch_alloc(sizeof(bottom_index));
       if (r == 0) return(FALSE);
       GC_top_index[hi] = r;
       BZERO(r, sizeof (bottom_index));
index b018d78e48d52fceffdb488c5678c8fc959117d7..8403b4494b3d83a4e40286cd1f57277d822bcccd 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3658,7 +3658,7 @@ ssize_t read(int fd, void *buf, size_t nbyte)
 # include <sys/stat.h>
 
 # define INITIAL_BUF_SZ 16384
-  STATIC word GC_proc_buf_size = INITIAL_BUF_SZ;
+  STATIC size_t GC_proc_buf_size = INITIAL_BUF_SZ;
   STATIC char *GC_proc_buf = NULL;
   STATIC int GC_proc_fd = 0;
 
@@ -3704,7 +3704,7 @@ GC_INNER void GC_read_dirty(void)
     bufp = GC_proc_buf;
     if (READ(GC_proc_fd, bufp, GC_proc_buf_size) <= 0) {
         /* Retry with larger buffer.    */
-        word new_size = 2 * GC_proc_buf_size;
+        size_t new_size = 2 * GC_proc_buf_size;
         char *new_buf;
 
         WARN("/proc read failed: GC_proc_buf_size = %" WARN_PRIdPTR "\n",