From 337753a7c9adf3b16167616e8ffec1a69ca92922 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Thu, 19 Oct 2000 16:05:48 +0200
Subject: [PATCH] Fixed a few warnings.

Rev: src/array.c:1.91
Rev: src/pike_memory.c:1.92
---
 src/array.c       | 12 +++++++-----
 src/pike_memory.c | 20 ++++++++++++++------
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/array.c b/src/array.c
index 6deeab47d5..078d354ce4 100644
--- a/src/array.c
+++ b/src/array.c
@@ -23,7 +23,7 @@
 #include "stuff.h"
 #include "bignum.h"
 
-RCSID("$Id: array.c,v 1.90 2000/10/10 01:20:37 hubbe Exp $");
+RCSID("$Id: array.c,v 1.91 2000/10/19 13:58:45 grubba Exp $");
 
 PMOD_EXPORT struct array empty_array=
 {
@@ -1525,10 +1525,12 @@ void describe_array(struct array *a,struct processing *p,int indent)
       return;
     }
   }
-  
-  sprintf(buf, a->size == 1 ? "({ /* %ld element */\n" :
-	                      "({ /* %ld elements */\n",
-	  (long)a->size);
+
+  if (a->size == 1) {
+    sprintf(buf, "({ /* 1 element */\n");
+  } else {
+    sprintf(buf, "({ /* %ld elements */\n", (long)a->size);
+  }
   my_strcat(buf);
   describe_array_low(a,&doing,indent);
   my_putchar('\n');
diff --git a/src/pike_memory.c b/src/pike_memory.c
index 913d2f4fdb..74a01018a8 100644
--- a/src/pike_memory.c
+++ b/src/pike_memory.c
@@ -10,7 +10,7 @@
 #include "pike_macros.h"
 #include "gc.h"
 
-RCSID("$Id: pike_memory.c,v 1.91 2000/10/13 19:40:08 hubbe Exp $");
+RCSID("$Id: pike_memory.c,v 1.92 2000/10/19 14:05:48 grubba Exp $");
 
 /* strdup() is used by several modules, so let's provide it */
 #ifndef HAVE_STRDUP
@@ -1025,8 +1025,8 @@ char *do_pad(char *mem, long size)
   return mem;
 }
 
-#define FD2PTR(X) (void *)((X)*4+1)
-#define PTR2FD(X) (((long)(X))>>2)
+#define FD2PTR(X) (void *)(ptrdiff_t)((X)*4+1)
+#define PTR2FD(X) (((ptrdiff_t)(X))>>2)
 
 
 void check_pad(struct memhdr *mh, int freeok)
@@ -1472,7 +1472,9 @@ void *debug_malloc(size_t s, LOCATION location)
   }
 
   if(verbose_debug_malloc)
-    fprintf(stderr, "malloc(%d) => %p  (%s)\n", s, m, LOCATION_NAME(location));
+    fprintf(stderr, "malloc(%ld) => %p  (%s)\n",
+	    DO_NOT_WARN((long)s),
+	    m, LOCATION_NAME(location));
 
   mt_unlock(&debug_malloc_mutex);
   return m;
@@ -1485,7 +1487,10 @@ void *debug_calloc(size_t a, size_t b, LOCATION location)
     MEMSET(m, 0, a*b);
 
   if(verbose_debug_malloc)
-    fprintf(stderr, "calloc(%d,%d) => %p  (%s)\n", a, b, m, LOCATION_NAME(location));
+    fprintf(stderr, "calloc(%ld, %ld) => %p  (%s)\n",
+	    DO_NOT_WARN((long)a),
+	    DO_NOT_WARN((long)b),
+	    m, LOCATION_NAME(location));
 
   return m;
 }
@@ -1504,7 +1509,10 @@ void *debug_realloc(void *p, size_t s, LOCATION location)
     low_make_memhdr(m, s, location)->flags|=MEM_PADDED;
   }
   if(verbose_debug_malloc)
-    fprintf(stderr, "realloc(%p,%d) => %p  (%s)\n", p, s, m, LOCATION_NAME(location));
+    fprintf(stderr, "realloc(%p, %ld) => %p  (%s)\n",
+	    p,
+	    DO_NOT_WARN((long)s),
+	    m, LOCATION_NAME(location));
   mt_unlock(&debug_malloc_mutex);
   return m;
 }
-- 
GitLab