warnings in libbb.h

Bernhard Fischer rep.nop at aon.at
Sun Sep 11 21:15:40 UTC 2005


Hi,

There are a couple of warnings in libbb.h. Sorry if this was brought up
before.

Can we remove them or how should they be dealt with?
Please let me know what you think, TIA.


//#warning rename?
extern int   bb_fclose_nonstdin(FILE *f);

s/_nonstdin// ?


//#warning rename?
extern FILE *bb_wfopen_input(const char *filename);


//#warning rename to xferror_filename?
extern void bb_xferror(FILE *fp, const char *fn);


//#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. Would the attached
patch be appropriate (slightly tested with allyesconfig and both malloc
and alloc on stack)?


//#warning pitchable now?
extern unsigned long bb_xparse_number(const char *numstr,

Current users are: stty, dd, losetup
It looks a bit like bb_xgetularg_bnd_sfx and friends, so we might use
those instead. Haven't looked closely.


//#warning change names?
my_getpwnam, my_getgrnam, my_getug, my_getpwuid, my_getgrgid

I'd rename them to bb_*(), fwiw.


//#warning yuk!
char *fgets_str(FILE *file, const char *terminating_string);


//#warning wrap this?
char *dirname (char *path);

at least rmdir.c includes libgen.h, so we may put that include just into
libbb.h and remove that definition.


//#warning put these in .o files
CURRENT_TTY, CONSOLE_DEV.
Maybe messages.c would be a good place to put them.



-------------- next part --------------
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__ */


More information about the busybox mailing list