]> granicus.if.org Git - libevent/commitdiff
Build correctly with mm replacement turned off.
authorNick Mathewson <nickm@torproject.org>
Wed, 18 Nov 2009 21:16:47 +0000 (21:16 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 18 Nov 2009 21:16:47 +0000 (21:16 +0000)
svn:r1547

evthread_pthread.c
test/regress.c
test/regress_buffer.c

index a76f42963db75ecfa53cd6249993bd9e8561e300..e8e2314ed83083fda7eaf69f6f7b90c83e8fcc37 100644 (file)
@@ -32,6 +32,7 @@
 struct event_base;
 #include <event2/thread.h>
 
+#include <stdlib.h>
 #include "mm-internal.h"
 
 static pthread_mutexattr_t attr_recursive;
index f5fc93e51f11f89b75f2704e64143300465f929b..aeb6a0b2167208de2fca77a6f3ae08ce911e29a7 100644 (file)
@@ -1860,6 +1860,13 @@ end:
        }
 }
 
+#ifdef _EVENT_DISABLE_MM_REPLACEMENT
+static void
+test_mm_functions(void *arg)
+{
+       _tinytest_set_test_skipped();
+}
+#else
 static int
 check_dummy_mem_ok(void *_mem)
 {
@@ -1914,6 +1921,7 @@ end:
        if (b)
                event_base_free(b);
 }
+#endif
 
 static void
 many_event_cb(int fd, short event, void *arg)
index 3421b922ab3a44b78db7099c8016fb6273a56ca2..ae28622e7eda99b65265e3b74156e7faa4009ded 100644 (file)
@@ -401,12 +401,14 @@ test_evbuffer_add_file(void *ptr)
 }
 #endif
 
+#ifndef _EVENT_DISABLE_MM_REPLACEMENT
 static void *
 failing_malloc(size_t how_much)
 {
        errno = ENOMEM;
        return NULL;
 }
+#endif
 
 static void
 test_evbuffer_readln(void *ptr)
@@ -604,6 +606,7 @@ test_evbuffer_readln(void *ptr)
        evbuffer_validate(evb);
 
        /* the next call to readline should fail */
+#ifndef _EVENT_DISABLE_MM_REPLACEMENT
        event_set_mem_functions(failing_malloc, realloc, free);
        cp = evbuffer_readln(evb, &sz, EVBUFFER_EOL_LF);
        tt_assert(cp == NULL);
@@ -611,6 +614,7 @@ test_evbuffer_readln(void *ptr)
 
        /* now we should get the next line back */
        event_set_mem_functions(malloc, realloc, free);
+#endif
        cp = evbuffer_readln(evb, &sz, EVBUFFER_EOL_LF);
        tt_line_eq("two line");
        free(cp); cp = NULL;