]> granicus.if.org Git - graphviz/commitdiff
apply patch-lib__vmalloc__features__vmalloc-dyld-uses-malloc.diff (from ryandesign)
authorJohn Ellson <ellson@research.att.com>
Fri, 1 Nov 2013 20:22:15 +0000 (16:22 -0400)
committerJohn Ellson <ellson@research.att.com>
Fri, 1 Nov 2013 20:22:15 +0000 (16:22 -0400)
lib/vmalloc/features/vmalloc

index 5d632c6e05b0cd52f2cb0db1fb63e125afdb225f..1512a1e27661b835c41491011d2b94a12aa561ec 100644 (file)
@@ -44,16 +44,23 @@ mal alloca note{ alloca is based on malloc() }end execute{
        #if _hdr_alloca
        #include        <alloca.h>
        #endif
+       #include <dlfcn.h>
+       volatile int testing_alloca = 0;
        #if _STD_
        void* malloc(unsigned int size)
        #else
        void* malloc(size) unsigned int size;
        #endif
-       {       exit(0);
+       {       if (!testing_alloca) {
+                       return ((void *(*)(unsigned int)) dlsym(RTLD_NEXT, "malloc"))(size);
+               }
+               exit(0);
                return 0;
        }
        main()
-       {       alloca(10);
+       {       testing_alloca = 1;
+               alloca(10);
+               testing_alloca = 0;
                return 1;
        }
 }end