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

List:       busybox
Subject:    =?KOI8-R?Q?=EF=D4=D7=C5=D4:_chpst?=
From:       "Vladimir Dronnikov" <dronnikov () gmail ! com>
Date:       2008-07-30 19:49:07
Message-ID: 6784529b0807301249p490e3e7amfacbb60b15dc2bbf () mail ! gmail ! com
[Download RAW message or body]

The first method you proposed just moves all those ifdefs outside the
main(). Thus readability conservation law holds.

The second (# and ## macro expansions) is better but preprocessor does
not support directives in macros. So one can not use, say:
#define lim(a,b) \
  #ifdef RLIMIT_##a \
    limit(RLIMIT_##a, limit##b); \
  #else \
    bb_error.....("no support for RLIMIT_" #a); \
  #endif

Thus again no gain :)

I propose two solutions:
1) use generic failure message, e.g. "system does not support this
limit" and check getrlimit return value to trigger that message. No
check for #ifdef RLIMIT_* is performed.

2) compile out options which has no RLIMIT_* defined for them, e.g.
#ifndef RLIMIT_AS then OPT_a is disallowed.

In either case comments (and applying:) are welcome!

--
Vladimir


-- 
Vladimir
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

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