warnings in libbb.h

Rob Landley rob at landley.net
Mon Sep 12 01:37:43 UTC 2005


On Sunday 11 September 2005 16:15, Bernhard Fischer wrote:
> 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.

These comments seem like somebody's "notes to self".  Might be worth checking 
the history to figure out who that was...

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

Nope, this function only closes f if it's != stdin.  Not the same as 
bb_fclose() at all.

All the "warning rename" comments seem to be "maybe we should rename this 
function", but in most cases it looks more like we need to document what they 
do, which is a general problem for the whole libbb directory.  We need an 
inventory and documentation of that...

> //#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)?

I don't seem to have a dmalloc.h anywhere on my system (ubuntu "hoar-infested 
hedgehog" release.  Hey, I finally upgraded from knoppix 3.6... :)  What's it 
for?

I just ripped out the two #includes and did a clean make allyesconfig, and it 
built just fine.  What exactly was this needed for in the first place?

> //#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.

Well, for starters losetup could pretty happily use atol(), since -o is just 
bytes...

>
> //#warning change names?
> my_getpwnam, my_getgrnam, my_getug, my_getpwuid, my_getgrgid
>
> I'd rename them to bb_*(), fwiw.

bb_xgetgrnam() seems more likely for the first one, since the x generally 
seems to mean "die if this isn't found"...

Tito was the last guy to play with these. :)

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

Compare to bb_get_line_from_file()...

> //#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.

Possibly they're trying to avoid the two versions of basename().  (check out 
"man 3 dirname"...)  Or maybe they want something that doesn't modify its 
argument...

Do we really need libbb.h to #include standard headers for the applets?  This 
isn't something busybox defines, I don't know why we have a prototype for it 
at all...
>
> //#warning put these in .o files
> CURRENT_TTY, CONSOLE_DEV.
> Maybe messages.c would be a good place to put them.

A) I think those are translated messages.  What's the deal with this #ifdef L_ 
stuff, anyway?  (Is this automatically generated by the dependency stuff?)

B) Compare mtab_file.c.

I've avoided opening the "libbb cleanup" can of worms so far because, well, 
it's big...

Rob



More information about the busybox mailing list