#include <ctype.h>
#include <arpa/inet.h>
+/* bbox: not needed
#define INT_CONF ntohl(0x434f4e46)
#define INT_ONFI ntohl(0x4f4e4649)
#define INT_NFIG ntohl(0x4e464947)
#define INT_FIG_ ntohl(0x4649475f)
+*/
char *target;
char *depfile;
void parse_config_file(char *map, size_t len)
{
- int *end = (int *) (map + len);
- /* start at +1, so that p can never be < map */
- int *m = (int *) map + 1;
- char *p, *q;
-
- for (; m < end; m++) {
- if (*m == INT_CONF) { p = (char *) m ; goto conf; }
- if (*m == INT_ONFI) { p = (char *) m-1; goto conf; }
- if (*m == INT_NFIG) { p = (char *) m-2; goto conf; }
- if (*m == INT_FIG_) { p = (char *) m-3; goto conf; }
- continue;
- conf:
- if (p > map + len - 7)
- continue;
- if (memcmp(p, "CONFIG_", 7))
- continue;
- for (q = p + 7; q < map + len; q++) {
- if (!(isalnum(*q) || *q == '_'))
- goto found;
+ /* modified for bbox */
+ char *end_4 = map + len - 4; /* 4 == length of "USE_" */
+ char *end_7 = map + len - 7;
+ char *p = map;
+ char *q;
+ int off;
+
+ for (; p < end_4; p++) {
+ if (p < end_7 && p[6] == '_') {
+ if (!memcmp(p, "CONFIG", 6)) goto conf7;
+ if (!memcmp(p, "ENABLE", 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;
continue;
- found:
- use_config(p+7, q-p-7);
+ conf4: off = 4;
+ conf5: off = 5;
+ conf7: off = 7;
+ p += off;
+ for (q = p; q < end_4+4; q++) {
+ if (!(isalnum(*q) || *q == '_'))
+ break;
+ }
+ use_config(p, q-p);
}
}
char *p;
char s[PATH_MAX];
- p = strchr(m, ':');
+ p = memchr(m, ':', len);
if (!p) {
fprintf(stderr, "fixdep: parse error\n");
exit(1);
void traps(void)
{
+/* bbox: not needed
static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
if (*(int *)test != INT_CONF) {
*(int *)test);
exit(2);
}
+*/
}
-int main(int argc, char *argv[])
+int main(int argc, char **argv)
{
traps();