[PATCH] some Mac OS X fixes

Devin Bayer devin at freeshell.org
Fri Feb 17 18:47:30 UTC 2006


Mike Frysinger wrote:
> On Friday 17 February 2006 11:44, Devin Bayer wrote:
> 
>>>>--- libbb/run_parts.c   (revision 14086)
>>>>+++ libbb/run_parts.c   (working copy)
>>>>+#ifdef __APPLE__
>>>>+static int valid_name(struct dirent *d)
>>>>+#else
>>>> static int valid_name(const struct dirent *d)
>>>>-{
>>>>+#endif
>>>>+       {
>>>
>>>Why?
>>
>>To avoid:
>>
>>libbb/run_parts.c:66: warning: passing argument 3 of 'scandir' from
>>incompatible pointer type
>>
>>because on apple:
>>
>>scandir(const char *dirname, struct dirent ***namelist,
>>          int (*select)(struct dirent *),
>>          int (*compar)(const void *, const void *));
> 
> i'd say live with it rather than making the code look fugly ... it's a 
> harmless warning in this case

Warnings are never harmless.  They waste the programmer's time by having to
examine the code and man pages to understand the nature of the problem.
I don't like the #ifdef kludge either.  Please consider the possibility
of defining USE_GNU(x) or SKIP_APPLE(x).  Then we have:

static int valid_name( USE_GNU(const) struct dirent *d)

-- 
Devin Bayer



More information about the busybox mailing list