extb_combi: More int to bool conversion

Cleanup whitespace in ircd_lexer.l
This commit is contained in:
Matt Ullman 2016-03-25 19:47:30 -04:00
parent fdba4417dc
commit afba2488ec
2 changed files with 23 additions and 23 deletions

View file

@ -52,7 +52,7 @@ static int _modinit(void);
static void _moddeinit(void); static void _moddeinit(void);
static int eb_or(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type); static int eb_or(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
static int eb_and(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type); static int eb_and(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
static int eb_combi(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type, int is_and); static int eb_combi(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type, bool is_and);
static int recursion_depth = 0; static int recursion_depth = 0;
DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc); DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
@ -76,20 +76,20 @@ _moddeinit(void)
static int eb_or(const char *data, struct Client *client_p, static int eb_or(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type) struct Channel *chptr, long mode_type)
{ {
return eb_combi(data, client_p, chptr, mode_type, FALSE); return eb_combi(data, client_p, chptr, mode_type, false);
} }
static int eb_and(const char *data, struct Client *client_p, static int eb_and(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type) struct Channel *chptr, long mode_type)
{ {
return eb_combi(data, client_p, chptr, mode_type, TRUE); return eb_combi(data, client_p, chptr, mode_type, true);
} }
static int eb_combi(const char *data, struct Client *client_p, static int eb_combi(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type, int is_and) struct Channel *chptr, long mode_type, bool is_and)
{ {
const char *p, *banend; const char *p, *banend;
int have_result = FALSE; bool have_result = false;
int allowed_nodes = 11; int allowed_nodes = 11;
size_t datalen; size_t datalen;
@ -143,12 +143,12 @@ static int eb_combi(const char *data, struct Client *client_p,
recursion_depth++; recursion_depth++;
while (--allowed_nodes) { while (--allowed_nodes) {
int invert = FALSE; bool invert = false;
char *child_data, child_data_buf[BANLEN]; char *child_data, child_data_buf[BANLEN];
ExtbanFunc f; ExtbanFunc f;
if (*p == '~') { if (*p == '~') {
invert = TRUE; invert = true;
p++; p++;
if (p == banend) { if (p == banend) {
MOD_DEBUG("combo invalid: no data after ~"); MOD_DEBUG("combo invalid: no data after ~");
@ -164,7 +164,7 @@ static int eb_combi(const char *data, struct Client *client_p,
if (*p == ':') { if (*p == ':') {
unsigned int parencount = 0; unsigned int parencount = 0;
int escaped = FALSE, done = FALSE; bool escaped = false, done = false;
char *o; char *o;
p++; p++;
@ -173,7 +173,7 @@ static int eb_combi(const char *data, struct Client *client_p,
* we already have_result. * we already have_result.
*/ */
o = child_data = child_data_buf; o = child_data = child_data_buf;
while (TRUE) { while (true) {
if (p == banend) { if (p == banend) {
if (parencount) { if (parencount) {
MOD_DEBUG("combo invalid: EOD while in parens"); MOD_DEBUG("combo invalid: EOD while in parens");
@ -186,11 +186,11 @@ static int eb_combi(const char *data, struct Client *client_p,
if (*p != '(' && *p != ')' && *p != '\\' && *p != ',') if (*p != '(' && *p != ')' && *p != '\\' && *p != ',')
*o++ = '\\'; *o++ = '\\';
*o++ = *p++; *o++ = *p++;
escaped = FALSE; escaped = false;
} else { } else {
switch (*p) { switch (*p) {
case '\\': case '\\':
escaped = TRUE; escaped = true;
break; break;
case '(': case '(':
parencount++; parencount++;
@ -208,7 +208,7 @@ static int eb_combi(const char *data, struct Client *client_p,
if (parencount) if (parencount)
*o++ = *p; *o++ = *p;
else else
done = TRUE; done = true;
break; break;
default: default:
*o++ = *p; *o++ = *p;
@ -239,7 +239,7 @@ static int eb_combi(const char *data, struct Client *client_p,
child_result = child_result == EXTBAN_MATCH; child_result = child_result == EXTBAN_MATCH;
if (is_and ? !child_result : child_result) if (is_and ? !child_result : child_result)
have_result = TRUE; have_result = true;
} }
if (p == banend) if (p == banend)

View file

@ -66,7 +66,7 @@ char linebuf[512];
#define YY_INPUT(buf,result,max_size) \ #define YY_INPUT(buf,result,max_size) \
if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \ if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \
YY_FATAL_ERROR("input in flex scanner failed"); YY_FATAL_ERROR("input in flex scanner failed");
%} %}
ws [ \t]* ws [ \t]*
@ -101,9 +101,9 @@ include \.include{ws}(\<.*\>|\".*\")
{ {
int i,j; int i,j;
yylval.string[yyleng-2] = '\0'; /* remove close yylval.string[yyleng-2] = '\0'; /* remove close
* quote * quote
*/ */
for (j=i=0 ;yylval.string[i] != '\0'; i++,j++) for (j=i=0 ;yylval.string[i] != '\0'; i++,j++)
{ {
if (yylval.string[i] != '\\') if (yylval.string[i] != '\\')
@ -113,7 +113,7 @@ include \.include{ws}(\<.*\>|\".*\")
else else
{ {
i++; i++;
if (yylval.string[i] == '\0') /* XXX if (yylval.string[i] == '\0') /* XXX
* should not * should not
* happen * happen
*/ */
@ -133,7 +133,7 @@ include \.include{ws}(\<.*\>|\".*\")
loadmodule { return LOADMODULE; } loadmodule { return LOADMODULE; }
{string} { {string} {
strcpy(yylval.string, yytext); strcpy(yylval.string, yytext);
yylval.string[yyleng] = '\0'; yylval.string[yyleng] = '\0';
return STRING; return STRING;
@ -148,7 +148,7 @@ loadmodule { return LOADMODULE; }
void ccomment() void ccomment()
{ {
int c; int c;
/* log(L_NOTICE, "got comment"); */ /* log(L_NOTICE, "got comment"); */
while (1) while (1)
{ {
@ -157,7 +157,7 @@ void ccomment()
if (c == '*') if (c == '*')
{ {
while ((c = input()) == '*'); while ((c = input()) == '*');
if (c == '/') if (c == '/')
break; break;
if (c == '\n') ++lineno; if (c == '\n') ++lineno;
} }
@ -182,15 +182,15 @@ void cinclude(void)
else else
*strchr(++c, '>') = 0; *strchr(++c, '>') = 0;
/* do stacking and co. */ /* do stacking and co. */
if (include_stack_ptr >= MAX_INCLUDE_DEPTH) if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
conf_report_error("Includes nested too deep (max is %d)", MAX_INCLUDE_DEPTH); conf_report_error("Includes nested too deep (max is %d)", MAX_INCLUDE_DEPTH);
else else
{ {
FILE *tmp_fbfile_in; FILE *tmp_fbfile_in;
tmp_fbfile_in = fopen(c, "r"); tmp_fbfile_in = fopen(c, "r");
if (tmp_fbfile_in == NULL) if (tmp_fbfile_in == NULL)
{ {
/* if its not found in PREFIX, look in IRCD_PATH_ETC */ /* if its not found in PREFIX, look in IRCD_PATH_ETC */