Skip to content

Commit

Permalink
Removed malloc wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Snaipe committed Jan 20, 2015
1 parent ee9b804 commit 2df7ca9
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 133 deletions.
4 changes: 1 addition & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ subdirinclude_HEADERS = \

libcsptr_la_SOURCES = \
src/mman.h \
src/mman.c \
src/wrap_malloc.h \
src/wrap_malloc.c
src/mman.c

man3_MANS = doc/csptr.3
8 changes: 0 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ AC_ARG_WITH([fixed-allocator],
[AC_DEFINE([SMALLOC_FIXED_ALLOCATOR], [1], [Define if malloc should always be used.])],
[])

AC_ARG_WITH([malloc-wrapper],
[AS_HELP_STRING([--with-malloc-wrapper], [Make smart pointers compatible with a pass to free, and make malloc return a smart pointer.])],
[AC_DEFINE([SMALLOC_WRAP_MALLOC], [1], [Define if malloc should be wrapped])
FLAG_WRAP_MALLOC="-Wl,--no-as-needed -ldl"
AC_SUBST([FLAG_WRAP_MALLOC])
],
[])

AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[Compile the project with converage enabled])],
Expand Down
9 changes: 0 additions & 9 deletions src/mman.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "config.h"
#include "mman.h"
#include "array.h"
#include "wrap_malloc.h"
#undef smalloc

s_allocator smalloc_allocator = {malloc, free};
Expand Down Expand Up @@ -63,11 +62,7 @@ __attribute__ ((malloc))
INLINE static void *alloc_entry(size_t head, size_t size, size_t metasize) {
const size_t totalsize = head + size + metasize + sizeof (size_t);
#ifdef SMALLOC_FIXED_ALLOCATOR
# ifdef SMALLOC_WRAP_MALLOC
return real_malloc(totalsize);
# else /* !SMALLOC_WRAP_MALLOC */
return malloc(totalsize);
# endif /* !SMALLOC_WRAP_MALLOC */
#else /* !SMALLOC_FIXED_ALLOCATOR */
return smalloc_allocator.alloc(totalsize);
#endif /* !SMALLOC_FIXED_ALLOCATOR */
Expand All @@ -85,11 +80,7 @@ INLINE static void dealloc_entry(s_meta *meta, void *ptr) {
}

#ifdef SMALLOC_FIXED_ALLOCATOR
# ifdef SMALLOC_WRAP_MALLOC
real_free(meta);
# else /* !SMALLOC_WRAP_MALLOC */
free(meta);
# endif /* !SMALLOC_WRAP_MALLOC */
#else /* !SMALLOC_FIXED_ALLOCATOR */
smalloc_allocator.dealloc(meta);
#endif /* !SMALLOC_FIXED_ALLOCATOR */
Expand Down
80 changes: 0 additions & 80 deletions src/wrap_malloc.c

This file was deleted.

33 changes: 0 additions & 33 deletions src/wrap_malloc.h

This file was deleted.

0 comments on commit 2df7ca9

Please sign in to comment.