mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Build correctly with mm replacement turned off.
svn:r1547
This commit is contained in:
parent
767eb70f50
commit
9bf124bff6
@ -32,6 +32,7 @@
|
||||
struct event_base;
|
||||
#include <event2/thread.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "mm-internal.h"
|
||||
|
||||
static pthread_mutexattr_t attr_recursive;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user