Helps follow-up work. No functional changes.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
+/* Return pointer to directive content, or NULL if not a directive. */
+static char *is_directive(char *line)
+{
+ if (line[0] == '!')
+ return line + 1;
+
+ return NULL;
+}
+
/*
* Parse file, calling action specific functions for:
* 1) Lines containing !E
/*
* Parse file, calling action specific functions for:
* 1) Lines containing !E
static void parse_file(FILE *infile)
{
char line[MAXLINESZ];
static void parse_file(FILE *infile)
{
char line[MAXLINESZ];
while (fgets(line, MAXLINESZ, infile)) {
while (fgets(line, MAXLINESZ, infile)) {
+ p = is_directive(line);
+ if (!p) {
defaultline(line);
continue;
}
defaultline(line);
continue;
}
- s = line + 2;
- switch (line[1]) {
+ s = p + 1;
+ switch (*p++) {
case 'E':
while (*s && !isspace(*s)) s++;
*s = '\0';
case 'E':
while (*s && !isspace(*s)) s++;
*s = '\0';
- externalfunctions(line+2);
break;
case 'I':
while (*s && !isspace(*s)) s++;
*s = '\0';
break;
case 'I':
while (*s && !isspace(*s)) s++;
*s = '\0';
- internalfunctions(line+2);
break;
case 'D':
while (*s && !isspace(*s)) s++;
*s = '\0';
break;
case 'D':
while (*s && !isspace(*s)) s++;
*s = '\0';
break;
case 'F':
/* filename */
break;
case 'F':
/* filename */
/* function names */
while (isspace(*s))
s++;
/* function names */
while (isspace(*s))
s++;
- singlefunctions(line +2, s);
break;
case 'P':
/* filename */
break;
case 'P':
/* filename */
/* DOC: section name */
while (isspace(*s))
s++;
/* DOC: section name */
while (isspace(*s))
s++;
- docsection(line + 2, s);
break;
case 'C':
while (*s && !isspace(*s)) s++;
*s = '\0';
if (findall)
break;
case 'C':
while (*s && !isspace(*s)) s++;
*s = '\0';
if (findall)
break;
default:
defaultline(line);
break;
default:
defaultline(line);