]> Creatis software - gdcm.git/commitdiff
BUG: Provide a fix(=hack) for bcc32, since jasper does not support this compiler
authormalaterre <malaterre>
Tue, 5 Jul 2005 23:05:31 +0000 (23:05 +0000)
committermalaterre <malaterre>
Tue, 5 Jul 2005 23:05:31 +0000 (23:05 +0000)
src/gdcmjasper/src/libjasper/base/jas_malloc.c

index 6ad4ed2426d0bc7c0cd6dc68df8368cb239d1148..cc8fef8c6d6672d5f1ea8c43515a5b4ab8f0e2e4 100644 (file)
@@ -64,7 +64,7 @@
 /*
  * Memory Allocator
  *
- * $Id: jas_malloc.c,v 1.1 2005/05/22 18:32:59 malaterre Exp $
+ * $Id: jas_malloc.c,v 1.2 2005/07/05 23:05:31 malaterre Exp $
  */
 
 /******************************************************************************\
 
 void *jas_malloc(size_t size)
 {
+#ifdef __BORLANDC__
+  // Apparently jasper does not take into account POSIX:
+  // http://www.opengroup.org/onlinepubs/007908799/xsh/malloc.html
+  // If the size of the space requested is 0, the behaviour is implementation-dependent; 
+  // the value returned will be either a null pointer or a unique pointer.
+
+  // As quick fix always over allocate so we avoid the case of the NULL pointer
+  return malloc(size+1);
+#else
   return malloc(size);
+#endif
 }
 
 void jas_free(void *ptr)