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:
7
eval.c
7
eval.c
@ -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;
|
||||
|
Reference in New Issue
Block a user