[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH 4/6] android: fix 'stat', ifdef S_TYPEIS* in coreutiles/stat.c
From:       Rich Felker <dalias () aerifal ! cx>
Date:       2012-05-28 23:31:39
Message-ID: 20120528233139.GI163 () brightrain ! aerifal ! cx
[Download RAW message or body]

On Mon, May 28, 2012 at 11:44:32PM +0200, Tias Guns wrote:
> +#ifndef __ANDROID__
>  	if (S_TYPEISMQ(st))        return "message queue";
>  	if (S_TYPEISSEM(st))       return "semaphore";
>  	if (S_TYPEISSHM(st))       return "shared memory object";
> +#endif

Instead of encoding system-specific knowledge like this in the source
files, you should do:

#ifdef S_TYPEISMQ
 	if (S_TYPEISMQ(st))        return "message queue";
#endif
#ifdef S_TYPEISSEM
 	if (S_TYPEISSEM(st))        return "semaphore";
#endif
...

Not only will this avoid hideous 1980s-style source uglification where
each source file is full of all sorts of ugly platform-specific
knowledge; it will also make it so the features are immediately
available if Android ever does add them (whereas your version would
leave them off on Android until somebody fixes it, then it would have
to be changed to something even more hideous like #if
__ANDROID_VERSION > xxx ...).

Note that the code RIGHT BELOW your changes does this exactly the
right way...

Rich
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic