[patch][RESEND] tweak busybox' dmalloc support

Manuel Novoa III mjn3 at codepoet.org
Tue Sep 13 22:59:09 UTC 2005


On Wed, Sep 14, 2005 at 12:24:15AM +0200, Bernhard Fischer wrote:
> To whom it may concern, Manuel?

Probably not mine as I generally don't use '//' comments in c code.

> 
> in libbb.h one can currently read:
> //#warning is this needed anymore?
> #ifndef DMALLOC
> extern void *xmalloc (size_t size);
> extern void *xrealloc(void *old, size_t size);
> extern void *xcalloc(size_t nmemb, size_t size);
> 
> 
> My dmalloc undef's those before it defines them. Also, it is
> recommended that dmalloc should be included last.
> 
> Attached patch removes the note to someone's self in libbb.h and makes
> sure that dmalloc.h is included as the last header.
> 
> PS: See the big fat WARNING in
> http://dmalloc.com/docs/5.4.2/online/dmalloc_11.html#SEC11
> about the recommended location of the dmalloc.h include.
> 
> 
> Please apply,
> Bernhard

> diff -X excl -rup busybox.oorig/include/busybox.h busybox/include/busybox.h
> --- busybox.oorig/include/busybox.h	2005-07-28 18:51:59.000000000 +0200
> +++ busybox/include/busybox.h	2005-09-11 22:57:29.000000000 +0200
> @@ -44,10 +44,6 @@
>  #define BB_BANNER "BusyBox v" BB_VER " (" BB_EXTRA_VERSION ")"
>  #endif
>  
> -#ifdef DMALLOC
> -#include <dmalloc.h>
> -#endif
> -
>  #include <features.h>
>  
>  /* Pull in the utility routines from libbb */
> @@ -118,4 +114,8 @@ extern const struct BB_applet applets[];
>  #define  PATH_MAX         256
>  #endif
>  
> +#ifdef DMALLOC
> +#include <dmalloc.h>
> +#endif
> +
>  #endif							/* _BB_INTERNAL_H_ */
> diff -X excl -rup busybox.oorig/include/libbb.h busybox/include/libbb.h
> --- busybox.oorig/include/libbb.h	2005-09-05 21:44:17.000000000 +0200
> +++ busybox/include/libbb.h	2005-09-11 23:00:39.000000000 +0200
> @@ -35,15 +35,11 @@
>  
>  #include <netdb.h>
>  
> -#ifdef DMALLOC
> -#include <dmalloc.h>
> -#endif
> -
>  #include <features.h>
>  
>  #include "bb_config.h"
>  #ifdef CONFIG_SELINUX
> -#include <selinux/selinux.h>  
> +#include <selinux/selinux.h>
>  #endif
>  
>  #include "pwd_.h"
> @@ -182,12 +178,10 @@ extern const char *bb_skip_whitespace(co
>  extern struct BB_applet *find_applet_by_name(const char *name);
>  void run_applet_by_name(const char *name, int argc, char **argv);
>  
> -//#warning is this needed anymore?
> -#ifndef DMALLOC
> -extern void *xmalloc (size_t size);
> +extern void *xmalloc(size_t size);
>  extern void *xrealloc(void *old, size_t size);
>  extern void *xcalloc(size_t nmemb, size_t size);
> -#endif
> +
>  extern char *bb_xstrdup (const char *s);
>  extern char *bb_xstrndup (const char *s, int n);
>  extern char *safe_strncpy(char *dst, const char *src, size_t size);
> @@ -482,4 +476,9 @@ extern void xregcomp(regex_t *preg, cons
>  #define HASH_MD5	2
>  extern int hash_fd(int fd, const size_t size, const uint8_t hash_algo, uint8_t *hashval);
>  
> +/* busybox.h will include dmalloc later for us, else include it here.  */
> +#if !defined _BB_INTERNAL_H_ && defined DMALLOC
> +#include <dmalloc.h>
> +#endif
> +
>  #endif /* __LIBCONFIG_H__ */

> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/cgi-bin/mailman/listinfo/busybox



More information about the busybox mailing list