Commit 6dd16f44 authored by Randy Dunlap's avatar Randy Dunlap Committed by Sam Ravnborg

docproc: style & typo cleanups

- fix typos/spellos in docproc.c and Makefile
- add a little whitespace {while, switch} (coding style)
- use NULL instead of 0 for pointer testing
Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 70f75246
### ###
# Makefile.basic list the most basic programs used during the build process. # Makefile.basic lists the most basic programs used during the build process.
# The programs listed herein is what is needed to do the basic stuff, # The programs listed herein are what are needed to do the basic stuff,
# such as fix dependency file. # such as fix file dependencies.
# This initial step is needed to avoid files to be recompiled # This initial step is needed to avoid files to be recompiled
# when kernel configuration changes (which is what happens when # when kernel configuration changes (which is what happens when
# .config is included by main Makefile. # .config is included by main Makefile.
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# fixdep: Used to generate dependency information during build process # fixdep: Used to generate dependency information during build process
# docproc: Used in Documentation/docbook # docproc: Used in Documentation/DocBook
hostprogs-y := fixdep docproc hostprogs-y := fixdep docproc
always := $(hostprogs-y) always := $(hostprogs-y)
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
* documentation-frontend * documentation-frontend
* Scans the template file and call kernel-doc for * Scans the template file and call kernel-doc for
* all occurrences of ![EIF]file * all occurrences of ![EIF]file
* Beforehand each referenced file are scanned for * Beforehand each referenced file is scanned for
* any exported sympols "EXPORT_SYMBOL()" statements. * any symbols that are exported via these macros:
* EXPORT_SYMBOL(), EXPORT_SYMBOL_GPL(), &
* EXPORT_SYMBOL_GPL_FUTURE()
* This is used to create proper -function and * This is used to create proper -function and
* -nofunction arguments in calls to kernel-doc. * -nofunction arguments in calls to kernel-doc.
* Usage: docproc doc file.tmpl * Usage: docproc doc file.tmpl
...@@ -73,7 +75,7 @@ void usage (void) ...@@ -73,7 +75,7 @@ void usage (void)
} }
/* /*
* Execute kernel-doc with parameters givin in svec * Execute kernel-doc with parameters given in svec
*/ */
void exec_kernel_doc(char **svec) void exec_kernel_doc(char **svec)
{ {
...@@ -82,7 +84,7 @@ void exec_kernel_doc(char **svec) ...@@ -82,7 +84,7 @@ void exec_kernel_doc(char **svec)
char real_filename[PATH_MAX + 1]; char real_filename[PATH_MAX + 1];
/* Make sure output generated so far are flushed */ /* Make sure output generated so far are flushed */
fflush(stdout); fflush(stdout);
switch(pid=fork()) { switch (pid=fork()) {
case -1: case -1:
perror("fork"); perror("fork");
exit(1); exit(1);
...@@ -133,6 +135,7 @@ struct symfile * add_new_file(char * filename) ...@@ -133,6 +135,7 @@ struct symfile * add_new_file(char * filename)
symfilelist[symfilecnt++].filename = strdup(filename); symfilelist[symfilecnt++].filename = strdup(filename);
return &symfilelist[symfilecnt - 1]; return &symfilelist[symfilecnt - 1];
} }
/* Check if file already are present in the list */ /* Check if file already are present in the list */
struct symfile * filename_exist(char * filename) struct symfile * filename_exist(char * filename)
{ {
...@@ -156,8 +159,8 @@ void noaction2(char * file, char * line) { file = file; line = line; } ...@@ -156,8 +159,8 @@ void noaction2(char * file, char * line) { file = file; line = line; }
void printline(char * line) { printf("%s", line); } void printline(char * line) { printf("%s", line); }
/* /*
* Find all symbols exported with EXPORT_SYMBOL and EXPORT_SYMBOL_GPL * Find all symbols in filename that are exported with EXPORT_SYMBOL &
* in filename. * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly).
* All symbols located are stored in symfilelist. * All symbols located are stored in symfilelist.
*/ */
void find_export_symbols(char * filename) void find_export_symbols(char * filename)
...@@ -179,15 +182,15 @@ void find_export_symbols(char * filename) ...@@ -179,15 +182,15 @@ void find_export_symbols(char * filename)
perror(real_filename); perror(real_filename);
exit(1); exit(1);
} }
while(fgets(line, MAXLINESZ, fp)) { while (fgets(line, MAXLINESZ, fp)) {
char *p; char *p;
char *e; char *e;
if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != 0) || if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != NULL) ||
((p = strstr(line, "EXPORT_SYMBOL")) != 0)) { ((p = strstr(line, "EXPORT_SYMBOL")) != NULL)) {
/* Skip EXPORT_SYMBOL{_GPL} */ /* Skip EXPORT_SYMBOL{_GPL} */
while (isalnum(*p) || *p == '_') while (isalnum(*p) || *p == '_')
p++; p++;
/* Remove paranteses and additional ws */ /* Remove parentheses & additional whitespace */
while (isspace(*p)) while (isspace(*p))
p++; p++;
if (*p != '(') if (*p != '(')
...@@ -211,7 +214,7 @@ void find_export_symbols(char * filename) ...@@ -211,7 +214,7 @@ void find_export_symbols(char * filename)
* Document all external or internal functions in a file. * Document all external or internal functions in a file.
* Call kernel-doc with following parameters: * Call kernel-doc with following parameters:
* kernel-doc -docbook -nofunction function_name1 filename * kernel-doc -docbook -nofunction function_name1 filename
* function names are obtained from all the src files * Function names are obtained from all the src files
* by find_export_symbols. * by find_export_symbols.
* intfunc uses -nofunction * intfunc uses -nofunction
* extfunc uses -function * extfunc uses -function
...@@ -262,7 +265,7 @@ void singfunc(char * filename, char * line) ...@@ -262,7 +265,7 @@ void singfunc(char * filename, char * line)
vec[idx++] = KERNELDOC; vec[idx++] = KERNELDOC;
vec[idx++] = DOCBOOK; vec[idx++] = DOCBOOK;
/* Split line up in individual parameters preceeded by FUNCTION */ /* Split line up in individual parameters preceded by FUNCTION */
for (i=0; line[i]; i++) { for (i=0; line[i]; i++) {
if (isspace(line[i])) { if (isspace(line[i])) {
line[i] = '\0'; line[i] = '\0';
...@@ -292,7 +295,7 @@ void parse_file(FILE *infile) ...@@ -292,7 +295,7 @@ void parse_file(FILE *infile)
{ {
char line[MAXLINESZ]; char line[MAXLINESZ];
char * s; char * s;
while(fgets(line, MAXLINESZ, infile)) { while (fgets(line, MAXLINESZ, infile)) {
if (line[0] == '!') { if (line[0] == '!') {
s = line + 2; s = line + 2;
switch (line[1]) { switch (line[1]) {
...@@ -351,9 +354,9 @@ int main(int argc, char *argv[]) ...@@ -351,9 +354,9 @@ int main(int argc, char *argv[])
{ {
/* Need to do this in two passes. /* Need to do this in two passes.
* First pass is used to collect all symbols exported * First pass is used to collect all symbols exported
* in the various files. * in the various files;
* Second pass generate the documentation. * Second pass generate the documentation.
* This is required because function are declared * This is required because some functions are declared
* and exported in different files :-(( * and exported in different files :-((
*/ */
/* Collect symbols */ /* Collect symbols */
...@@ -396,4 +399,3 @@ int main(int argc, char *argv[]) ...@@ -396,4 +399,3 @@ int main(int argc, char *argv[])
fflush(stdout); fflush(stdout);
return exitstatus; return exitstatus;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment