Extract memarea into its own library

This commit is contained in:
Nick Mathewson 2018-06-28 09:25:18 -04:00
parent 9cf335c9a5
commit eee86e627b
9 changed files with 39 additions and 8 deletions

2
.gitignore vendored
View File

@ -187,6 +187,8 @@ uptime-*.json
/src/lib/libtor-log-testing.a
/src/lib/libtor-malloc.a
/src/lib/libtor-malloc-testing.a
/src/lib/libtor-memarea.a
/src/lib/libtor-memarea-testing.a
/src/lib/libtor-net.a
/src/lib/libtor-net-testing.a
/src/lib/libtor-sandbox.a

View File

@ -46,6 +46,7 @@ TOR_UTIL_LIBS = \
src/lib/libtor-container.a \
src/lib/libtor-net.a \
src/lib/libtor-thread.a \
src/lib/libtor-memarea.a \
src/lib/libtor-log.a \
src/lib/libtor-lock.a \
src/lib/libtor-fdio.a \
@ -67,6 +68,7 @@ TOR_UTIL_TESTING_LIBS = \
src/lib/libtor-container-testing.a \
src/lib/libtor-net-testing.a \
src/lib/libtor-thread-testing.a \
src/lib/libtor-memarea-testing.a \
src/lib/libtor-log-testing.a \
src/lib/libtor-lock-testing.a \
src/lib/libtor-fdio-testing.a \

View File

@ -29,7 +29,6 @@ LIBOR_A_SRC = \
src/common/compat.c \
src/common/compat_time.c \
src/common/conffile.c \
src/common/memarea.c \
src/common/util.c \
src/common/util_process.c \
src/common/storagedir.c \
@ -71,7 +70,6 @@ COMMONHEADERS = \
src/common/compat_time.h \
src/common/conffile.h \
src/common/handles.h \
src/common/memarea.h \
src/common/procmon.h \
src/common/storagedir.h \
src/common/timers.h \

View File

@ -14,6 +14,7 @@ include src/lib/include.libdonna.am
include src/lib/intmath/include.am
include src/lib/lock/include.am
include src/lib/log/include.am
include src/lib/memarea/include.am
include src/lib/malloc/include.am
include src/lib/net/include.am
include src/lib/sandbox/include.am

View File

@ -0,0 +1,6 @@
orconfig.h
lib/arch/*.h
lib/cc/*.h
lib/log/*.h
lib/malloc/*.h
lib/memarea/*.h

View File

@ -0,0 +1,17 @@
noinst_LIBRARIES += src/lib/libtor-memarea.a
if UNITTESTS_ENABLED
noinst_LIBRARIES += src/lib/libtor-memarea-testing.a
endif
src_lib_libtor_memarea_a_SOURCES = \
src/lib/memarea/memarea.c
src_lib_libtor_memarea_testing_a_SOURCES = \
$(src_lib_libtor_memarea_a_SOURCES)
src_lib_libtor_memarea_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
src_lib_libtor_memarea_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
noinst_HEADERS += \
src/lib/memarea/memarea.h

View File

@ -7,12 +7,16 @@
*/
#include "orconfig.h"
#include <stddef.h>
#include "lib/memarea/memarea.h"
#include <stdlib.h>
#include "common/memarea.h"
#include "common/util.h"
#include "common/compat.h"
#include <string.h>
#include "lib/cc/torint.h"
#include "lib/arch/bytes.h"
#include "lib/log/torlog.h"
#include "lib/log/util_bug.h"
#include "lib/malloc/util_malloc.h"
#ifndef DISABLE_MEMORY_SENTINELS
@ -394,4 +398,3 @@ memarea_assert_ok(memarea_t *area)
}
#endif /* !defined(DISABLE_MEMORY_SENTINELS) */

View File

@ -5,6 +5,8 @@
#ifndef TOR_MEMAREA_H
#define TOR_MEMAREA_H
#include <stddef.h>
typedef struct memarea_t memarea_t;
memarea_t *memarea_new(void);
@ -26,4 +28,3 @@ void memarea_get_stats(memarea_t *area,
void memarea_assert_ok(memarea_t *area);
#endif /* !defined(TOR_MEMAREA_H) */

View File

@ -155,6 +155,7 @@ pub fn main() {
cfg.component("tor-encoding-testing");
cfg.component("tor-net");
cfg.component("tor-thread-testing");
cfg.component("tor-memarea-testing");
cfg.component("tor-log");
cfg.component("tor-lock");
cfg.component("tor-fdio");