Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > ee1a38cafd8b9b54617df7994560ea02 > files > 2

gc-7.1-7.1.mga1.src.rpm

From 6a93f8e5bcad22137f41b6c60a1c7384baaec2b3 Mon Sep 17 00:00:00 2001
From: Ivan Maidanski <ivmai@mail.ru>
Date: Thu, 15 Mar 2012 20:30:11 +0400
Subject: [PATCH] Fix calloc-related code to prevent SIZE_MAX redefinition in
 sys headers

* malloc.c: Include limits.h for SIZE_MAX.
* malloc.c (SIZE_MAX, calloc): Define GC_SIZE_MAX instead of SIZE_MAX.
---
 malloc.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Index: libgc/malloc.c
===================================================================
--- libgc.orig/malloc.c	2012-07-08 18:08:40.030368600 +0200
+++ libgc/malloc.c	2012-07-08 18:08:45.420373752 +0200
@@ -344,12 +344,16 @@
   }
 #endif
 
-#ifndef SIZE_MAX
-#define SIZE_MAX (~(size_t)0)
+#include <limits.h>
+#ifdef SIZE_MAX
+# define GC_SIZE_MAX SIZE_MAX
+#else
+# define GC_SIZE_MAX (~(size_t)0)
 #endif
+
 void * calloc(size_t n, size_t lb)
 {
-    if (lb && n > SIZE_MAX / lb)
+    if (lb && n > GC_SIZE_MAX / lb)
       return NULL;
 #   if defined(GC_LINUX_THREADS) /* && !defined(USE_PROC_FOR_LIBRARIES) */
 	/* libpthread allocated some memory that is only pointed to by	*/