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

7
eval.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.94 2011/01/21 22:25:32 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.95 2011/03/07 20:30:36 tg Exp $");
/*
* string expansion
@ -507,8 +507,9 @@ expand(const char *cp, /* input word */
while (p >= sbeg) {
bool gotmatch;
c = *p; *p = '\0';
gotmatch = gmatchx(sbeg, tpat0, false);
c = *p;
*p = '\0';
gotmatch = tobool(gmatchx(sbeg, tpat0, false));
*p = c;
if (gotmatch)
break;