*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
This commit is contained in:
@ -225,32 +225,36 @@ void use_config(char *m, int slen)
|
||||
void parse_config_file(char *map, size_t len)
|
||||
{
|
||||
/* modified for bbox */
|
||||
char *end_4 = map + len - 4; /* 4 == length of "USE_" */
|
||||
char *end_3 = map + len - 3; /* 3 == length of "IF_" */
|
||||
char *end_7 = map + len - 7;
|
||||
char *p = map;
|
||||
char *q;
|
||||
int off;
|
||||
|
||||
for (; p < end_4; p++) {
|
||||
for (; p <= end_3; p++) {
|
||||
/* Find next identifier's beginning */
|
||||
if (!(isalnum(*p) || *p == '_'))
|
||||
continue;
|
||||
|
||||
/* Check it */
|
||||
if (p < end_7 && p[6] == '_') {
|
||||
if (!memcmp(p, "CONFIG", 6)) goto conf7;
|
||||
if (!memcmp(p, "ENABLE", 6)) goto conf7;
|
||||
if (!memcmp(p, "IF_NOT", 6)) goto conf7;
|
||||
}
|
||||
/* We have at least 5 chars: for() has
|
||||
* "p < end-4", not "p <= end-4"
|
||||
* therefore we don't need to check p <= end-5 here */
|
||||
if (p[4] == '_')
|
||||
if (!memcmp(p, "SKIP", 4)) goto conf5;
|
||||
/* Ehhh, gcc is too stupid to just compare it as 32bit int */
|
||||
if (p[0] == 'U')
|
||||
if (!memcmp(p, "USE_", 4)) goto conf4;
|
||||
/* we have at least 3 chars because of p <= end_3 */
|
||||
/*if (!memcmp(p, "IF_", 3)) goto conf3;*/
|
||||
if (p[0] == 'I' && p[1] == 'F' && p[2] == '_') goto conf3;
|
||||
|
||||
/* This identifier is not interesting, skip it */
|
||||
while (p <= end_3 && (isalnum(*p) || *p == '_'))
|
||||
p++;
|
||||
continue;
|
||||
|
||||
conf4: off = 4;
|
||||
conf5: off = 5;
|
||||
conf3: off = 3;
|
||||
conf7: off = 7;
|
||||
p += off;
|
||||
for (q = p; q < end_4+4; q++) {
|
||||
for (q = p; q < end_3+3; q++) {
|
||||
if (!(isalnum(*q) || *q == '_'))
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user