introduce a tobool(cond) abstraction¹ and switch bool to char if !stdbool.h

① currently: ((cond) ? true : false) but (!!(cond)) and casting to bool,
  the latter only if stdbool.h, would also work – which performs best on
  (and across) all supported systems?
This commit is contained in:
tg
2011-03-07 20:30:41 +00:00
parent 009d4c7b75
commit 5f8075fc82
8 changed files with 31 additions and 24 deletions

4
misc.c
View File

@@ -29,7 +29,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.152 2011/03/05 21:43:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.153 2011/03/07 20:30:39 tg Exp $");
/* type bits for unsigned char */
unsigned char chtypes[UCHAR_MAX + 1];
@@ -433,7 +433,7 @@ parse_args(const char **argv,
xstrcmp);
}
if (arrayset)
go.optind += set_array(array, arrayset > 0 ? true : false,
go.optind += set_array(array, tobool(arrayset > 0),
argv + go.optind);
return (go.optind);