malloca: Avoid warnings on x86_64 mingw64.
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 24 Jan 2012 12:21:56 +0000 (13:21 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 25 Jan 2012 22:47:25 +0000 (23:47 +0100)
* lib/malloca.c: Include <stdint.h>.
(mmalloca, freea): Use uintptr_t to convert pointers to integers.
* modules/malloca (Depends-on): Add stdint.
* modules/relocatable-prog-wrapper (Depends-on): Likewise.

ChangeLog
lib/malloca.c
modules/malloca
modules/relocatable-prog-wrapper

index cd2ba5b..2aa1e83 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-24  Marc-André Lureau  <marcandre.lureau@redhat.com>  (tiny change)
+           Bruno Haible  <bruno@clisp.org>
+
+       malloca: Avoid warnings on x86_64 mingw64.
+       * lib/malloca.c: Include <stdint.h>.
+       (mmalloca, freea): Use uintptr_t to convert pointers to integers.
+       * modules/malloca (Depends-on): Add stdint.
+       * modules/relocatable-prog-wrapper (Depends-on): Likewise.
+
 2012-01-25  Paul Eggert  <eggert@cs.ucla.edu>
 
        obstack: remove __STDC__ conditionals
index c81ffbc..4557a90 100644 (file)
@@ -22,6 +22,8 @@
 /* Specification.  */
 #include "malloca.h"
 
+#include <stdint.h>
+
 #include "verify.h"
 
 /* The speed critical point in this file is freea() applied to an alloca()
@@ -85,7 +87,7 @@ mmalloca (size_t n)
           ((int *) p)[-1] = MAGIC_NUMBER;
 
           /* Enter p into the hash table.  */
-          slot = (unsigned long) p % HASH_TABLE_SIZE;
+          slot = (uintptr_t) p % HASH_TABLE_SIZE;
           ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
           mmalloca_results[slot] = p;
 
@@ -118,7 +120,7 @@ freea (void *p)
         {
           /* Looks like a mmalloca() result.  To see whether it really is one,
              perform a lookup in the hash table.  */
-          size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
+          size_t slot = (uintptr_t) p % HASH_TABLE_SIZE;
           void **chain = &mmalloca_results[slot];
           for (; *chain != NULL;)
             {
index 57cbe32..bb9e9b4 100644 (file)
@@ -11,6 +11,7 @@ m4/longlong.m4
 
 Depends-on:
 alloca-opt
+stdint
 verify
 
 configure.ac:
index 8ff11d4..e5dccd5 100644 (file)
@@ -39,6 +39,7 @@ errno
 pathmax
 ssize_t
 stdbool
+stdint
 stdlib
 unistd
 environ