From: Peter Johnson Date: Mon, 29 Oct 2001 00:01:31 +0000 (-0000) Subject: Add option for malloc debugging using dmalloc library (http://dmalloc.com/). X-Git-Tag: v0.1.0~233 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=adf5a95e89b5d047b8c5e8c028e243bc84678246;p=yasm Add option for malloc debugging using dmalloc library (http://dmalloc.com/). Remove unnecessary stdlib includes (because we use xmalloc instead of malloc). svn path=/trunk/yasm/; revision=297 --- diff --git a/configure.ac b/configure.ac index d2d19677..b6d59fbd 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,14 @@ AC_ARG_ENABLE(profiling, *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;; esac],[profiling=false]) +AC_ARG_ENABLE(dmalloc, +[ --enable-dmalloc Enable debug malloc (requires dmalloc library)], +[case "${enableval}" in + yes) dmalloc=true ;; + no) dmalloc=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-dmalloc) ;; +esac],[dmalloc=false]) + AC_ARG_ENABLE(check, [ --disable-check Disable building of test suite and make check], [case "${enableval}" in @@ -53,23 +61,36 @@ AM_CONDITIONAL(CHECK, test x$check = xtrue) AM_PROG_CC_STDC if ${dev}; then - DEVFLAGS="-g" + DEVFLAGS=" -g" fi if ${morewarn}; then - MOREWARNFLAGS="-Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings" + MOREWARNFLAGS=" -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings" fi if ${warnerror}; then - WARNERRORFLAGS="-Werror" + WARNERRORFLAGS=" -Werror" fi if ${profiling}; then - PROFILINGFLAGS="-pg" + PROFILINGFLAGS=" -pg" +fi + +if ${dmalloc}; then + AC_CHECK_HEADERS(dmalloc.h) + AC_CHECK_LIB(dmalloc, main) + if test "$ac_cv_header_dmalloc_h" != yes || + test "$ac_cv_lib_dmalloc_main" != yes; then + AC_MSG_ERROR([dmalloc required for --enable-dmalloc.]) + else + DMALLOCFLAGS=" -DDMALLOC" + fi +else + DMALLOCFLAGS=" -Wredundant-decls" fi if test "$GCC" = yes; then - ANSI_CFLAGS="-ansi -pedantic -Wall $MOREWARNFLAGS $WARNERRORFLAGS $DEVFLAGS $PROFILINGFLAGS" + ANSI_CFLAGS="-ansi -pedantic -Wall$MOREWARNFLAGS$WARNERRORFLAGS$DEVFLAGS$PROFILINGFLAGS$DMALLOCFLAGS" else ANSI_CFLAGS="$DEVFLAGS" fi diff --git a/configure.in b/configure.in index d2d19677..b6d59fbd 100644 --- a/configure.in +++ b/configure.in @@ -41,6 +41,14 @@ AC_ARG_ENABLE(profiling, *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;; esac],[profiling=false]) +AC_ARG_ENABLE(dmalloc, +[ --enable-dmalloc Enable debug malloc (requires dmalloc library)], +[case "${enableval}" in + yes) dmalloc=true ;; + no) dmalloc=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-dmalloc) ;; +esac],[dmalloc=false]) + AC_ARG_ENABLE(check, [ --disable-check Disable building of test suite and make check], [case "${enableval}" in @@ -53,23 +61,36 @@ AM_CONDITIONAL(CHECK, test x$check = xtrue) AM_PROG_CC_STDC if ${dev}; then - DEVFLAGS="-g" + DEVFLAGS=" -g" fi if ${morewarn}; then - MOREWARNFLAGS="-Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings" + MOREWARNFLAGS=" -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings" fi if ${warnerror}; then - WARNERRORFLAGS="-Werror" + WARNERRORFLAGS=" -Werror" fi if ${profiling}; then - PROFILINGFLAGS="-pg" + PROFILINGFLAGS=" -pg" +fi + +if ${dmalloc}; then + AC_CHECK_HEADERS(dmalloc.h) + AC_CHECK_LIB(dmalloc, main) + if test "$ac_cv_header_dmalloc_h" != yes || + test "$ac_cv_lib_dmalloc_main" != yes; then + AC_MSG_ERROR([dmalloc required for --enable-dmalloc.]) + else + DMALLOCFLAGS=" -DDMALLOC" + fi +else + DMALLOCFLAGS=" -Wredundant-decls" fi if test "$GCC" = yes; then - ANSI_CFLAGS="-ansi -pedantic -Wall $MOREWARNFLAGS $WARNERRORFLAGS $DEVFLAGS $PROFILINGFLAGS" + ANSI_CFLAGS="-ansi -pedantic -Wall$MOREWARNFLAGS$WARNERRORFLAGS$DEVFLAGS$PROFILINGFLAGS$DMALLOCFLAGS" else ANSI_CFLAGS="$DEVFLAGS" fi diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c index edd8f3ed..6a93e7bc 100644 --- a/frontends/yasm/yasm.c +++ b/frontends/yasm/yasm.c @@ -53,6 +53,10 @@ #include "preproc.h" #include "parser.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #ifndef countof diff --git a/libyasm/bitvect.c b/libyasm/bitvect.c index 34b3a94c..20de3bb6 100644 --- a/libyasm/bitvect.c +++ b/libyasm/bitvect.c @@ -11,7 +11,6 @@ /* MODULE IMPORTS: */ /*****************************************************************************/ #ifdef STDC_HEADERS -#include /* MODULE TYPE: (sys) */ #include /* MODULE TYPE: (sys) */ #include /* MODULE TYPE: (sys) */ #include /* MODULE TYPE: (sys) */ @@ -21,6 +20,10 @@ /*****************************************************************************/ #include "bitvect.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* ToolBox.h */ diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index ee8125ab..24867681 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -28,7 +28,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -44,6 +43,10 @@ #include "bytecode.h" #include "section.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); struct effaddr { diff --git a/libyasm/errwarn.c b/libyasm/errwarn.c index 18091ee4..05760ed7 100644 --- a/libyasm/errwarn.c +++ b/libyasm/errwarn.c @@ -45,6 +45,10 @@ #include "globals.h" #include "errwarn.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Total error count for entire assembler run. diff --git a/libyasm/expr.c b/libyasm/expr.c index dc862135..2f1b507a 100644 --- a/libyasm/expr.c +++ b/libyasm/expr.c @@ -49,6 +49,10 @@ #include "expr.h" #include "symrec.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Types listed in canonical sorting order. See expr_order_terms(). */ diff --git a/libyasm/floatnum.c b/libyasm/floatnum.c index 2c1075f1..1329a5b3 100644 --- a/libyasm/floatnum.c +++ b/libyasm/floatnum.c @@ -31,7 +31,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -49,6 +48,10 @@ #include "errwarn.h" #include "floatnum.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* 97-bit internal floating point format: diff --git a/libyasm/intnum.c b/libyasm/intnum.c index 1d6c9fb4..05be9b5c 100644 --- a/libyasm/intnum.c +++ b/libyasm/intnum.c @@ -29,7 +29,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -42,6 +41,10 @@ #include "errwarn.h" #include "intnum.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #define BITVECT_ALLOC_SIZE 80 diff --git a/libyasm/mergesort.c b/libyasm/mergesort.c index 89d71235..21de4f71 100644 --- a/libyasm/mergesort.c +++ b/libyasm/mergesort.c @@ -38,6 +38,10 @@ #include "util.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #if defined(LIBC_SCCS) && !defined(lint) @@ -60,7 +64,6 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94"; #ifdef STDC_HEADERS # include -# include # include #endif diff --git a/libyasm/section.c b/libyasm/section.c index 2b90ec53..52d62a2d 100644 --- a/libyasm/section.c +++ b/libyasm/section.c @@ -28,7 +28,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -48,6 +47,10 @@ #include "section.h" #include "objfmt.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); struct section { diff --git a/libyasm/symrec.c b/libyasm/symrec.c index 46db876e..411278e6 100644 --- a/libyasm/symrec.c +++ b/libyasm/symrec.c @@ -28,7 +28,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -44,6 +43,10 @@ #include "bytecode.h" #include "section.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* DEFINED is set with EXTERN and COMMON below */ diff --git a/libyasm/xmalloc.c b/libyasm/xmalloc.c index 9a3cd351..baca2515 100644 --- a/libyasm/xmalloc.c +++ b/libyasm/xmalloc.c @@ -31,6 +31,8 @@ #include "errwarn.h" +#ifndef DMALLOC + RCSID("$IdPath$"); void * @@ -78,3 +80,4 @@ xrealloc(void *oldmem, size_t size) return newmem; } +#endif diff --git a/libyasm/xstrdup.c b/libyasm/xstrdup.c index 2efc8c8b..c0b30272 100644 --- a/libyasm/xstrdup.c +++ b/libyasm/xstrdup.c @@ -41,7 +41,6 @@ static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93"; #ifdef STDC_HEADERS # include -# include # include #else size_t strlen(const char *); @@ -53,6 +52,8 @@ void memcpy(void *, const void *, size_t); # endif #endif +#ifndef DMALLOC + RCSID("$IdPath$"); char * @@ -66,3 +67,4 @@ xstrdup(const char *str) memcpy(copy, str, len); return (copy); } +#endif diff --git a/mergesort.c b/mergesort.c index 89d71235..21de4f71 100644 --- a/mergesort.c +++ b/mergesort.c @@ -38,6 +38,10 @@ #include "util.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #if defined(LIBC_SCCS) && !defined(lint) @@ -60,7 +64,6 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94"; #ifdef STDC_HEADERS # include -# include # include #endif diff --git a/modules/arch/x86/expr.c b/modules/arch/x86/expr.c index dc862135..2f1b507a 100644 --- a/modules/arch/x86/expr.c +++ b/modules/arch/x86/expr.c @@ -49,6 +49,10 @@ #include "expr.h" #include "symrec.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Types listed in canonical sorting order. See expr_order_terms(). */ diff --git a/modules/arch/x86/x86expr.c b/modules/arch/x86/x86expr.c index dc862135..2f1b507a 100644 --- a/modules/arch/x86/x86expr.c +++ b/modules/arch/x86/x86expr.c @@ -49,6 +49,10 @@ #include "expr.h" #include "symrec.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Types listed in canonical sorting order. See expr_order_terms(). */ diff --git a/modules/parsers/nasm/bison.y.in b/modules/parsers/nasm/bison.y.in index 8da12974..234e6784 100644 --- a/modules/parsers/nasm/bison.y.in +++ b/modules/parsers/nasm/bison.y.in @@ -48,6 +48,10 @@ #include "section.h" #include "objfmt.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #define YYDEBUG 1 diff --git a/modules/parsers/nasm/nasm-bison.y b/modules/parsers/nasm/nasm-bison.y index 8da12974..234e6784 100644 --- a/modules/parsers/nasm/nasm-bison.y +++ b/modules/parsers/nasm/nasm-bison.y @@ -48,6 +48,10 @@ #include "section.h" #include "objfmt.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #define YYDEBUG 1 diff --git a/modules/parsers/nasm/nasm-parser.c b/modules/parsers/nasm/nasm-parser.c index 2f43d0c4..a4d9a519 100644 --- a/modules/parsers/nasm/nasm-parser.c +++ b/modules/parsers/nasm/nasm-parser.c @@ -27,10 +27,6 @@ #include -#ifdef STDC_HEADERS -# include -#endif - #include "errwarn.h" #include "bytecode.h" diff --git a/modules/parsers/nasm/parser.c b/modules/parsers/nasm/parser.c index 2f43d0c4..a4d9a519 100644 --- a/modules/parsers/nasm/parser.c +++ b/modules/parsers/nasm/parser.c @@ -27,10 +27,6 @@ #include -#ifdef STDC_HEADERS -# include -#endif - #include "errwarn.h" #include "bytecode.h" diff --git a/modules/parsers/nasm/token.l.in b/modules/parsers/nasm/token.l.in index d5dc46af..6973afbe 100644 --- a/modules/parsers/nasm/token.l.in +++ b/modules/parsers/nasm/token.l.in @@ -46,6 +46,10 @@ #include "bison.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #define YY_NEVER_INTERACTIVE 1 diff --git a/src/arch/x86/expr.c b/src/arch/x86/expr.c index dc862135..2f1b507a 100644 --- a/src/arch/x86/expr.c +++ b/src/arch/x86/expr.c @@ -49,6 +49,10 @@ #include "expr.h" #include "symrec.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Types listed in canonical sorting order. See expr_order_terms(). */ diff --git a/src/arch/x86/x86expr.c b/src/arch/x86/x86expr.c index dc862135..2f1b507a 100644 --- a/src/arch/x86/x86expr.c +++ b/src/arch/x86/x86expr.c @@ -49,6 +49,10 @@ #include "expr.h" #include "symrec.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Types listed in canonical sorting order. See expr_order_terms(). */ diff --git a/src/bitvect.c b/src/bitvect.c index 34b3a94c..20de3bb6 100644 --- a/src/bitvect.c +++ b/src/bitvect.c @@ -11,7 +11,6 @@ /* MODULE IMPORTS: */ /*****************************************************************************/ #ifdef STDC_HEADERS -#include /* MODULE TYPE: (sys) */ #include /* MODULE TYPE: (sys) */ #include /* MODULE TYPE: (sys) */ #include /* MODULE TYPE: (sys) */ @@ -21,6 +20,10 @@ /*****************************************************************************/ #include "bitvect.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* ToolBox.h */ diff --git a/src/bytecode.c b/src/bytecode.c index ee8125ab..24867681 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -28,7 +28,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -44,6 +43,10 @@ #include "bytecode.h" #include "section.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); struct effaddr { diff --git a/src/errwarn.c b/src/errwarn.c index 18091ee4..05760ed7 100644 --- a/src/errwarn.c +++ b/src/errwarn.c @@ -45,6 +45,10 @@ #include "globals.h" #include "errwarn.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Total error count for entire assembler run. diff --git a/src/expr.c b/src/expr.c index dc862135..2f1b507a 100644 --- a/src/expr.c +++ b/src/expr.c @@ -49,6 +49,10 @@ #include "expr.h" #include "symrec.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Types listed in canonical sorting order. See expr_order_terms(). */ diff --git a/src/floatnum.c b/src/floatnum.c index 2c1075f1..1329a5b3 100644 --- a/src/floatnum.c +++ b/src/floatnum.c @@ -31,7 +31,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -49,6 +48,10 @@ #include "errwarn.h" #include "floatnum.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* 97-bit internal floating point format: diff --git a/src/intnum.c b/src/intnum.c index 1d6c9fb4..05be9b5c 100644 --- a/src/intnum.c +++ b/src/intnum.c @@ -29,7 +29,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -42,6 +41,10 @@ #include "errwarn.h" #include "intnum.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #define BITVECT_ALLOC_SIZE 80 diff --git a/src/main.c b/src/main.c index edd8f3ed..6a93e7bc 100644 --- a/src/main.c +++ b/src/main.c @@ -53,6 +53,10 @@ #include "preproc.h" #include "parser.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #ifndef countof diff --git a/src/mergesort.c b/src/mergesort.c index 89d71235..21de4f71 100644 --- a/src/mergesort.c +++ b/src/mergesort.c @@ -38,6 +38,10 @@ #include "util.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #if defined(LIBC_SCCS) && !defined(lint) @@ -60,7 +64,6 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94"; #ifdef STDC_HEADERS # include -# include # include #endif diff --git a/src/parser.c b/src/parser.c index c6bc72ff..3b7d360e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -28,7 +28,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -42,6 +41,10 @@ #include "preproc.h" #include "parser.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* NULL-terminated list of all available parsers. diff --git a/src/parsers/nasm/bison.y.in b/src/parsers/nasm/bison.y.in index 8da12974..234e6784 100644 --- a/src/parsers/nasm/bison.y.in +++ b/src/parsers/nasm/bison.y.in @@ -48,6 +48,10 @@ #include "section.h" #include "objfmt.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #define YYDEBUG 1 diff --git a/src/parsers/nasm/nasm-bison.y b/src/parsers/nasm/nasm-bison.y index 8da12974..234e6784 100644 --- a/src/parsers/nasm/nasm-bison.y +++ b/src/parsers/nasm/nasm-bison.y @@ -48,6 +48,10 @@ #include "section.h" #include "objfmt.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #define YYDEBUG 1 diff --git a/src/parsers/nasm/nasm-parser.c b/src/parsers/nasm/nasm-parser.c index 2f43d0c4..a4d9a519 100644 --- a/src/parsers/nasm/nasm-parser.c +++ b/src/parsers/nasm/nasm-parser.c @@ -27,10 +27,6 @@ #include -#ifdef STDC_HEADERS -# include -#endif - #include "errwarn.h" #include "bytecode.h" diff --git a/src/parsers/nasm/parser.c b/src/parsers/nasm/parser.c index 2f43d0c4..a4d9a519 100644 --- a/src/parsers/nasm/parser.c +++ b/src/parsers/nasm/parser.c @@ -27,10 +27,6 @@ #include -#ifdef STDC_HEADERS -# include -#endif - #include "errwarn.h" #include "bytecode.h" diff --git a/src/parsers/nasm/token.l.in b/src/parsers/nasm/token.l.in index d5dc46af..6973afbe 100644 --- a/src/parsers/nasm/token.l.in +++ b/src/parsers/nasm/token.l.in @@ -46,6 +46,10 @@ #include "bison.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); #define YY_NEVER_INTERACTIVE 1 diff --git a/src/section.c b/src/section.c index 2b90ec53..52d62a2d 100644 --- a/src/section.c +++ b/src/section.c @@ -28,7 +28,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -48,6 +47,10 @@ #include "section.h" #include "objfmt.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); struct section { diff --git a/src/symrec.c b/src/symrec.c index 46db876e..411278e6 100644 --- a/src/symrec.c +++ b/src/symrec.c @@ -28,7 +28,6 @@ #include #ifdef STDC_HEADERS -# include # include #endif @@ -44,6 +43,10 @@ #include "bytecode.h" #include "section.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* DEFINED is set with EXTERN and COMMON below */ diff --git a/src/ternary.c b/src/ternary.c index 7b7b920f..04f8b2e0 100644 --- a/src/ternary.c +++ b/src/ternary.c @@ -28,14 +28,14 @@ #include -#ifdef STDC_HEADERS -#include -#endif - #include "errwarn.h" #include "ternary.h" +#ifdef DMALLOC +# include +#endif + RCSID("$IdPath$"); /* Non-recursive so we don't waste stack space/time on large diff --git a/src/xmalloc.c b/src/xmalloc.c index 9a3cd351..baca2515 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -31,6 +31,8 @@ #include "errwarn.h" +#ifndef DMALLOC + RCSID("$IdPath$"); void * @@ -78,3 +80,4 @@ xrealloc(void *oldmem, size_t size) return newmem; } +#endif diff --git a/src/xstrdup.c b/src/xstrdup.c index 2efc8c8b..c0b30272 100644 --- a/src/xstrdup.c +++ b/src/xstrdup.c @@ -41,7 +41,6 @@ static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93"; #ifdef STDC_HEADERS # include -# include # include #else size_t strlen(const char *); @@ -53,6 +52,8 @@ void memcpy(void *, const void *, size_t); # endif #endif +#ifndef DMALLOC + RCSID("$IdPath$"); char * @@ -66,3 +67,4 @@ xstrdup(const char *str) memcpy(copy, str, len); return (copy); } +#endif