diff options
author | Garrett Cooper <yanegomi@gmail.com> | 2010-11-23 09:27:44 -0800 |
---|---|---|
committer | Garrett Cooper <yanegomi@gmail.com> | 2010-11-23 09:27:44 -0800 |
commit | 903910df985927e941076692964ab88d691c8ccb (patch) | |
tree | f0fa86f8ca7f6ed5887d6fb4267dd1e21dc1eea9 /pan | |
parent | 002abb725ecc68ef1dcb594c5c64caf87f0ca0db (diff) |
More cleanup.
Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
Diffstat (limited to 'pan')
-rw-r--r-- | pan/debug.c | 10 | ||||
-rw-r--r-- | pan/debug.h | 8 | ||||
-rw-r--r-- | pan/ltp-bump.c | 2 | ||||
-rw-r--r-- | pan/ltp-pan.c | 22 | ||||
-rw-r--r-- | pan/reporter.c | 30 | ||||
-rw-r--r-- | pan/splitstr.c | 34 | ||||
-rw-r--r-- | pan/symbol.c | 94 | ||||
-rw-r--r-- | pan/tag_report.c | 96 | ||||
-rw-r--r-- | pan/zoolib.c | 16 |
9 files changed, 156 insertions, 156 deletions
diff --git a/pan/debug.c b/pan/debug.c index a89303cd6..d67c46f60 100644 --- a/pan/debug.c +++ b/pan/debug.c @@ -56,26 +56,26 @@ set_debug(char *optarg) d_area = optarg; - while(*d_area) { + while (*d_area) { d_level= strchr(d_area,':'); *d_level++ = '\0'; db_level= atoi(d_level); db_area=atoi(d_area); - if(db_area > MAXDEBUG) { + if (db_area > MAXDEBUG) { printf("Error - Debug area %s > maximum of %d\n", d_area, MAXDEBUG); exit(-1); } - while(d_area != NULL) { + while (d_area != NULL) { db_area = atoi(d_area); printf("Debug area %d set to %d\n", db_area, db_level); Debug[db_area] = db_level; - if((d_area = strchr(d_area, ',')) != NULL) + if ((d_area = strchr(d_area, ',')) != NULL) d_area++; } - if( (d_area = strchr(d_level, ',')) == NULL ) + if ((d_area = strchr(d_level, ',')) == NULL) break; } #else diff --git a/pan/debug.h b/pan/debug.h index d0fa145b3..996c9646d 100644 --- a/pan/debug.h +++ b/pan/debug.h @@ -45,13 +45,13 @@ int set_debug( char * ); extern int Debug[]; #define MAXDEBUG 30 -#define DEBUG(a,l) if(Debug[a] >= l) -#define DEBUGO(a,l,c) if(Debug[a] >= l || c) +#define DEBUG(a,l) if (Debug[a] >= l) +#define DEBUGO(a,l,c) if (Debug[a] >= l || c) #else -#define DEBUG(a,l) if(0) -#define DEBUGO(a,l,c) if(0) +#define DEBUG(a,l) if (0) +#define DEBUGO(a,l,c) if (0) #endif diff --git a/pan/ltp-bump.c b/pan/ltp-bump.c index 5ab6584db..29d3480b0 100644 --- a/pan/ltp-bump.c +++ b/pan/ltp-bump.c @@ -50,7 +50,7 @@ int main(int argc, char **argv) zoo_t zoo; int sig = SIGINT; - while((c = getopt(argc, argv, "a:s:12")) != -1) { + while ((c = getopt(argc, argv, "a:s:12")) != -1) { switch(c) { case 'a': active = (char*)malloc(strlen(optarg)+1); diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c index 86cd1542c..c894de701 100644 --- a/pan/ltp-pan.c +++ b/pan/ltp-pan.c @@ -323,7 +323,7 @@ main(int argc, char **argv) } coll = get_collection(filename, optind, argc, argv); - if(!coll) + if (!coll) exit(1); if (coll->cnt == 0) { fprintf(stderr, @@ -501,7 +501,7 @@ main(int argc, char **argv) if (++c >= coll->cnt) c = 0; - } /* while( (num_active < keep_active) && (starts != 0) ) */ + } /* while ((num_active < keep_active) && (starts != 0)) */ if (starts == 0) { @@ -942,7 +942,7 @@ run_child(struct coll_entry *colle, struct tag_pgrp *active, int quiet_mode) /* if the child couldn't go through with the exec, * clean up the mess, note it, and move on */ - if(read(errpipe[0], &errlen, sizeof(errlen))) { + if (read(errpipe[0], &errlen, sizeof(errlen))) { int status; time_t end_time; int termid; @@ -1033,7 +1033,7 @@ get_collection(char *file, int optind, int argc, char **argv) int i; buf = slurp(file); - if(!buf) + if (!buf) return NULL; coll = (struct collection *) malloc(sizeof(struct collection)); @@ -1295,21 +1295,21 @@ wait_handler( int sig ) { static int lastsent = 0; - if( sig == 0 ){ + if (sig == 0) { lastsent = 0; } else { rec_signal = sig; - if( sig == SIGUSR2 ) + if (sig == SIGUSR2) return; - if( lastsent == 0 ) + if (lastsent == 0) send_signal = sig; - else if( lastsent == SIGUSR1 ) + else if (lastsent == SIGUSR1) send_signal = SIGINT; - else if( lastsent == sig ) + else if (lastsent == sig) send_signal = SIGTERM; - else if( lastsent == SIGTERM ) + else if (lastsent == SIGTERM) send_signal = SIGHUP; - else if( lastsent == SIGHUP ) + else if (lastsent == SIGHUP) send_signal = SIGKILL; lastsent = send_signal; } diff --git a/pan/reporter.c b/pan/reporter.c index 114eeeedf..1c970c67c 100644 --- a/pan/reporter.c +++ b/pan/reporter.c @@ -110,7 +110,7 @@ scanner_reporter(tags) tl = taglist; sym_seq(tags, &Key, &Data, R_FIRST); do { - if(tagcount == ntags) { + if (tagcount == ntags) { /* exceeded tag array size -- realloc */ ntags += NTAGS_START; taglist= (char **)realloc(taglist, sizeof(char *) * ntags); @@ -119,9 +119,9 @@ scanner_reporter(tags) *tl++ = Key.data; tagcount++; - } while(sym_seq(tags, &Key, &Data, R_NEXT)==0); + } while (sym_seq(tags, &Key, &Data, R_NEXT)==0); - if(tagcount == ntags) { + if (tagcount == ntags) { /* exceeded tag array size -- realloc */ ntags += NTAGS_START; taglist= (char **)realloc(taglist, sizeof(char *) * ntags); @@ -131,10 +131,10 @@ scanner_reporter(tags) *tl++ = NULL; ntags = tagcount; /* Retrieve one "stime" to get the date. */ - for(tl=taglist; *tl != NULL; tl++) { + for (tl=taglist; *tl != NULL; tl++) { strcpy(key_get, *tl); strcat(key_get, ",_keys,stime"); - if((info = (char *)sym_get(tags, key_get)) != NULL) { + if ((info = (char *)sym_get(tags, key_get)) != NULL) { clock = atoi(info); tm = gmtime(&clock); strftime(key_get, KEYSIZE, "%x", tm); @@ -150,18 +150,18 @@ scanner_reporter(tags) * internals of the sym_* data structure. */ /* dump 'em all */ - for(tl=taglist; *tl != NULL; tl++) { - if(!strcmp(*tl, "_RTS")) + for (tl=taglist; *tl != NULL; tl++) { + if (!strcmp(*tl, "_RTS")) continue; strcpy(key_get, *tl); strcat(key_get, ",_keys"); - if((Keys = sym_get(tags, key_get)) == NULL) { + if ((Keys = sym_get(tags, key_get)) == NULL) { return 0; } strcpy(key_get, *tl); - if((Tag = sym_get(tags, key_get)) != NULL) { + if ((Tag = sym_get(tags, key_get)) != NULL) { tag_report(NULL, Tag, Keys); } } @@ -192,14 +192,14 @@ scanner_test_end(alltags, ctag, keys) SYM rm; /* pointer to old tag -- to remove it */ - if(alltags == NULL || keys == NULL || ctag == NULL) + if (alltags == NULL || keys == NULL || ctag == NULL) return -1; /* for really messed up test output */ /* insert keys into tag */ sym_put(ctag, "_keys", (void *)keys, 0); /* get the tag, or build a new one */ - if((tag=(char *)sym_get(keys, "tag")) == NULL) { + if ((tag=(char *)sym_get(keys, "tag")) == NULL) { /* this is an "impossible" situation: test_output checks for this * and creates a dummy tag. */ sprintf(tagname, "no_tag_%d", notag++); @@ -212,9 +212,9 @@ scanner_test_end(alltags, ctag, keys) * Special case: duplicate tag that has an initiation_status failure * is thrown away. */ - if((rm=(SYM)sym_get(alltags, tag)) != NULL) { - if( (status=(char *)sym_get(keys, "initiation_status")) != NULL ) { - if(strcmp(status, "ok")) { + if ((rm=(SYM)sym_get(alltags, tag)) != NULL) { + if ((status=(char *)sym_get(keys, "initiation_status")) != NULL) { + if (strcmp(status, "ok")) { /* do not take new data. remove new data */ sym_rm(ctag, RM_KEY | RM_DATA); return 1; @@ -247,7 +247,7 @@ static int iscanner_test_end(alltags, ctag, keys) SYM alltags, ctag, keys; { - if(alltags == NULL || keys == NULL || ctag == NULL) + if (alltags == NULL || keys == NULL || ctag == NULL) return -1; /* for really messed up test output */ /* insert keys into tag */ diff --git a/pan/splitstr.c b/pan/splitstr.c index 6c4cea8a1..14f2f000e 100644 --- a/pan/splitstr.c +++ b/pan/splitstr.c @@ -73,9 +73,9 @@ splitstr(const char *str, const char *separator, int *argcount) * In most recoverable errors, if argcount is not NULL, * set argcount to 0. Then return NULL. */ - if ( str == NULL ) + if (str == NULL) { - if ( argcount != NULL ) + if (argcount != NULL) *argcount = 0; return(NULL); } @@ -85,9 +85,9 @@ splitstr(const char *str, const char *separator, int *argcount) */ arg_string = strdup( str ); - if ( arg_string == NULL ) + if (arg_string == NULL) { - if ( argcount != NULL ) + if (argcount != NULL) *argcount = 0; return(NULL); } @@ -97,14 +97,14 @@ splitstr(const char *str, const char *separator, int *argcount) */ arg_array = (char **)malloc( sizeof(char *) * max_toks ); - if ( arg_array == NULL ) + if (arg_array == NULL) { - if ( argcount != NULL ) + if (argcount != NULL) *argcount = 0; return(NULL); } - if(separator==NULL) + if (separator==NULL) separator = " \t"; /* @@ -113,11 +113,11 @@ splitstr(const char *str, const char *separator, int *argcount) * 'arg_array' if necessary. */ cur_tok = strtok(arg_string, separator); - while ( cur_tok != NULL ) + while (cur_tok != NULL) { arg_array[num_toks++] = cur_tok; cur_tok = strtok(NULL, separator); - if ( num_toks == max_toks ) + if (num_toks == max_toks) { max_toks += 20; arg_array = (char **)realloc((void *)arg_array, sizeof(char *)*max_toks ); @@ -128,14 +128,14 @@ splitstr(const char *str, const char *separator, int *argcount) /* * If there are any spaces left in our array, make them NULL */ - for(i=num_toks+1;i<max_toks;i++) + for (i=num_toks+1;i<max_toks;i++) arg_array[i] = NULL; /* This seems nice, but since memory is allocated on a page basis, this * isn't really helpful: * arg_array = (char **)realloc((void *)arg_array, sizeof(char *)*num_toks+1 );*/ - if ( argcount != NULL ) + if (argcount != NULL) *argcount = num_toks; /* @@ -154,9 +154,9 @@ splitstr(const char *str, const char *separator, int *argcount) */ void splitstr_free( const char **p_return ) { - if ( *p_return != NULL ) + if (*p_return != NULL) free( (char *)*p_return ); - if ( p_return != NULL ) + if (p_return != NULL) free( (char **)p_return ); } @@ -170,23 +170,23 @@ int main() char *test_str_array[test_size]; const char **ret; - for(i=0;i<test_size;i++) + for (i=0;i<test_size;i++) { snprintf(buf,16,"arg%d",i); test_str_array[i] = strdup(buf); } - for(i=0;i<test_size;i++) + for (i=0;i<test_size;i++) { test_str[0]='\0'; - for(y=0;y<i;y++) + for (y=0;y<i;y++) { snprintf(buf,16,"arg%d ",y); strncat(test_str,buf,16); } ret = splitstr(test_str,NULL,&size_ret); assert(size_ret == i); - for(y=0;y<i;y++) + for (y=0;y<i;y++) assert( strcmp(ret[y],test_str_array[y])==0 ); splitstr_free(ret); diff --git a/pan/symbol.c b/pan/symbol.c index fa9e8aa58..bdd5843c1 100644 --- a/pan/symbol.c +++ b/pan/symbol.c @@ -86,7 +86,7 @@ SYM newsym() { SYM h; - if((h=(SYM)malloc(sizeof(struct symh))) == NULL) { + if ((h=(SYM)malloc(sizeof(struct symh))) == NULL) { sym_error="sym header malloc failed!"; return(NULL); } @@ -102,7 +102,7 @@ mknode(struct sym *next, char *key, void *data) { struct sym *n; - if((n=(struct sym *)malloc(sizeof(struct sym))) == NULL) { + if ((n=(struct sym *)malloc(sizeof(struct sym))) == NULL) { sym_error="sym node malloc failed!"; return(NULL); } @@ -111,7 +111,7 @@ mknode(struct sym *next, char *key, void *data) n->key = strdup(key); n->data = data; - if(n->key == NULL) { + if (n->key == NULL) { sym_error="sym node strdup(key) failed!"; return(NULL); } @@ -124,8 +124,8 @@ mknode(struct sym *next, char *key, void *data) static struct sym * find_key1(struct sym *sym, char *key) { - while(sym != NULL) - if(strcmp(sym->key, key) == 0) + while (sym != NULL) + if (strcmp(sym->key, key) == 0) return(sym); else sym=sym->next; @@ -140,20 +140,20 @@ add_key(SYM sym, char *key, void *data) { register struct sym *sn; - if(sym->sym == NULL) + if (sym->sym == NULL) { sym->sym = mknode(NULL, key, data); - if(sym->sym == NULL) + if (sym->sym == NULL) { return(-1); } } else { - for( sn=sym->sym; sn!=NULL && sn->next != NULL; sn=sn->next ); + for (sn=sym->sym; sn!=NULL && sn->next != NULL; sn=sn->next); sn->next = mknode(NULL, key, data); assert(sn->next != NULL); - if(sn->next == NULL) + if (sn->next == NULL) return(-1); } return(0); @@ -206,39 +206,39 @@ sym_put(SYM sym, char *key, void *data, int flags) SYM csym, ncsym; /* search: current symbol table */ struct sym *nsym = NULL; /* search: found symbol entry */ - if(sym == NULL) + if (sym == NULL) return(EINVAL); nkey = strdup(key); keys = splitstr(key, ",",NULL); - if(keys == NULL) + if (keys == NULL) return(EINVAL); - for(kk=(char **)keys, csym = sym; + for (kk=(char **)keys, csym = sym; *kk != NULL && (nsym=find_key1(csym->sym, *kk)) != NULL; csym=nsym->data) { - if(*++kk == NULL) + if (*++kk == NULL) break; - if(nsym->data == NULL) { /* fatal error */ + if (nsym->data == NULL) { /* fatal error */ free(nkey); splitstr_free(keys); return(ENOTDIR); } - if( ((SYM) (nsym->data))->magic != SYM_MAGIC ) { + if (((SYM) (nsym->data))->magic != SYM_MAGIC) { free(nkey); splitstr_free(keys); return(ENOTDIR); } } - if(*kk == NULL) { /* found a complete match */ + if (*kk == NULL) { /* found a complete match */ free(nkey); splitstr_free(keys); - if(flags == PUT_REPLACE) { + if (flags == PUT_REPLACE) { nsym->data = data; return(0); } else { @@ -247,8 +247,8 @@ sym_put(SYM sym, char *key, void *data, int flags) } /* csym is a ptr to a list */ - for(;*kk != NULL; kk++) { - if(*(kk+1) != NULL) { + for (;*kk != NULL; kk++) { + if (*(kk+1) != NULL) { add_key(csym, *kk, (void *)(ncsym=newsym())); csym = ncsym; } else { @@ -275,34 +275,34 @@ void * sym_get(SYM sym, char *key) SYM csym; /* search: current symbol table */ struct sym *nsym = NULL; /* search: found symbol entry */ - if(sym == NULL) + if (sym == NULL) return(NULL); nkey=strdup(key); keys = splitstr(nkey, ",", NULL); - if(keys == NULL) + if (keys == NULL) return(NULL); - for(kk=(char **)keys, csym = sym; + for (kk=(char **)keys, csym = sym; *kk != NULL && (nsym=find_key1(csym->sym, *kk)) != NULL; csym=nsym->data) { - if(*++kk == NULL) + if (*++kk == NULL) break; - if(nsym->data == NULL) { /* fatal error */ + if (nsym->data == NULL) { /* fatal error */ free(nkey); splitstr_free(keys); return(NULL); } - if( ((SYM)(nsym->data))->magic != SYM_MAGIC ) { + if (((SYM)(nsym->data))->magic != SYM_MAGIC) { free(nkey); splitstr_free(keys); return(NULL); } } - if(*kk == NULL) { /* found a complete match */ + if (*kk == NULL) { /* found a complete match */ splitstr_free(keys); free(nkey); return(nsym->data); @@ -338,11 +338,11 @@ int */ case R_CURSOR: csym = (SYM) sym_get(sym, (char *)key->data); - if( csym == NULL || csym->magic != SYM_MAGIC ) { + if (csym == NULL || csym->magic != SYM_MAGIC) { return(2); } sym->cursor = csym->sym; - if(sym->cursor == NULL) + if (sym->cursor == NULL) return(1); key->data = sym->cursor->key; data->data = sym->cursor->data; @@ -351,7 +351,7 @@ int case R_FIRST: sym->cursor = sym->sym; - if(sym->cursor == NULL) + if (sym->cursor == NULL) return(1); key->data = sym->cursor->key; data->data = sym->cursor->data; @@ -359,11 +359,11 @@ int return(0); case R_NEXT: - if(sym->cursor == NULL) + if (sym->cursor == NULL) return(1); sym->cursor = sym->cursor->next; - if(sym->cursor == NULL) + if (sym->cursor == NULL) return(1); key->data = sym->cursor->key; @@ -390,11 +390,11 @@ sym_dump(SYM sym, int depth) register struct sym *se; /* symbol entry */ register int d; - if(sym == NULL || sym->magic != SYM_MAGIC) + if (sym == NULL || sym->magic != SYM_MAGIC) return -1; - for(se=sym->sym;se != NULL;se=se->next) { - for(d=0;d < depth; d++) { + for (se=sym->sym;se != NULL;se=se->next) { + for (d=0;d < depth; d++) { putchar('"'); putchar(' '); } printf("%s\n", se->key); @@ -413,23 +413,23 @@ sym_dump_s(SYM sym, int depth) register struct sym *se; /* symbol entry */ register int d; - if(sym == NULL) + if (sym == NULL) return 0; - if(sym->magic != SYM_MAGIC) { - for(d=0;d < depth; d++) { + if (sym->magic != SYM_MAGIC) { + for (d=0;d < depth; d++) { putchar('"'); putchar(' '); } printf(" = %s\n", (char *)sym); return 0; } - for(se=sym->sym;se != NULL;se=se->next) { - for(d=0;d < depth; d++) { + for (se=sym->sym;se != NULL;se=se->next) { + for (d=0;d < depth; d++) { putchar('"'); putchar(' '); } printf("%s", se->key); - if(((SYM)se->data)->magic == SYM_MAGIC) { + if (((SYM)se->data)->magic == SYM_MAGIC) { putchar('\n'); sym_dump_s((SYM)se->data, depth+1); } else { @@ -447,26 +447,26 @@ sym_rm(SYM sym, int flags) { register struct sym *se, *nse; /* symbol entry */ - if(sym == NULL) + if (sym == NULL) return 0; - if(sym->magic != SYM_MAGIC) { - if(!(flags&RM_DATA)) + if (sym->magic != SYM_MAGIC) { + if (!(flags&RM_DATA)) free(sym); return 0; } - for(se=sym->sym;se != NULL;) { + for (se=sym->sym;se != NULL;) { sym_rm((SYM)se->data, flags); nse=se->next; - if(flags & RM_KEY) + if (flags & RM_KEY) free(se->key); - if(flags & RM_DATA) + if (flags & RM_DATA) free(se->data); free(se); se=nse; } - if(!(flags&RM_DATA)) + if (!(flags&RM_DATA)) free(sym); return 0; } diff --git a/pan/tag_report.c b/pan/tag_report.c index 0389e715d..9065f50e0 100644 --- a/pan/tag_report.c +++ b/pan/tag_report.c @@ -63,33 +63,33 @@ test_result(tag, tcid, tc, result, tags) char **cont; const char **cont_save; - if(tcid == NULL) + if (tcid == NULL) tcid = "-"; - if(tc == NULL) + if (tc == NULL) tc = "-"; - if(tag == NULL) + if (tag == NULL) tag = "test_result: no tag"; - if(result == NULL) + if (result == NULL) result = "(RESULT IS NULL)"; strcpy(expkey, "contacts"); /* note: the sym_get here does _not_ change the "cursor" */ - if((expert = (char *)sym_get(tags, expkey)) == NULL) { + if ((expert = (char *)sym_get(tags, expkey)) == NULL) { expert = "UNKNOWN"; } /* ' tr " " "_" ' */ - for(c = result; *c; c++) { - if(*c == ' ') { + for (c = result; *c; c++) { + if (*c == ' ') { *c = '_'; } } - if(*result == '\0') + if (*result == '\0') result = "?"; /* split contacts on "," and print out a line for each */ cont_save = splitstr(expert, ",", NULL); - for(cont=(char **)cont_save;*cont != NULL; cont++) { + for (cont=(char **)cont_save;*cont != NULL; cont++) { printf(FORMAT, tag, tcid, tc, result, *cont); } splitstr_free(cont_save); @@ -133,7 +133,7 @@ cuts_report(tags, keys, at, tag ) /* parse analysis type: cuts:tc-count */ ant = splitstr((dat=strdup(at)), ":",NULL); - if(ant[1] != NULL) + if (ant[1] != NULL) tccount=atoi(ant[1]); else tccount=0; @@ -148,22 +148,22 @@ cuts_report(tags, keys, at, tag ) tl = taglist; sym_seq(tags, &Key, &Data, R_FIRST); do { - if(tagcount == ntags) { + if (tagcount == ntags) { /* exceeded tag array size -- realloc */ ntags += NTCID_START; taglist= (char **)realloc(taglist, sizeof(char *) * ntags); tl = taglist+tagcount; } - if(strcmp((char *)Key.data, "_keys")==0) + if (strcmp((char *)Key.data, "_keys")==0) continue; DEBUG(D_REPORT, 10) printf("cuts_report: tcid %s\n", (char *)Key.data); *tl++ = Key.data; tagcount++; - } while(sym_seq(tags, &Key, &Data, R_NEXT)==0); + } while (sym_seq(tags, &Key, &Data, R_NEXT)==0); - if(tagcount == ntags) { + if (tagcount == ntags) { /* exceeded tag array size -- realloc */ ntags++; /* need just one more */ taglist= (char **)realloc(taglist, sizeof(char *) * ntags); @@ -176,7 +176,7 @@ cuts_report(tags, keys, at, tag ) /* dump all found records */ tcnum=0; - for(tl=taglist; *tl != NULL; tl++) { + for (tl=taglist; *tl != NULL; tl++) { strcpy(key_get, *tl); Key.data = (void *) key_get; @@ -190,14 +190,14 @@ cuts_report(tags, keys, at, tag ) (char *)Data.data); result = worst_case(result, (char *)Data.data); test_result(tag, *tl, (char *)Key.data, (char *)Data.data, keys); - if(atoi((char *)Key.data)) + if (atoi((char *)Key.data)) tcnum++; - } while(sym_seq(tags, &Key, &Data, R_NEXT)==0); + } while (sym_seq(tags, &Key, &Data, R_NEXT)==0); } test_result(tag, "*", "*", result, keys); - if(tccount != 0 && tccount != tcnum) + if (tccount != 0 && tccount != tcnum) test_result(tag, "-", "-", "TC count wrong", keys); free(taglist); @@ -243,39 +243,39 @@ tag_report(alltags, ctag, keys) /* Check all driver-level status first */ strcpy(key_get, "tag"); - if((tag = (char *)sym_get(keys, key_get)) == NULL) { + if ((tag = (char *)sym_get(keys, key_get)) == NULL) { return -1; } /* Check all driver-level status first */ strcpy(key_get, "initiation_status"); - if((is = (char *)sym_get(keys, key_get)) == NULL) { + if ((is = (char *)sym_get(keys, key_get)) == NULL) { test_result(tag, NULL, NULL, "no init status", keys); return -1; } - if(strcmp(is, "ok")) { + if (strcmp(is, "ok")) { test_result(tag, NULL, NULL, is, keys); } else { strcpy(key_get, "corefile"); - if((info = (char *)sym_get(keys, key_get)) != NULL) - if(strcmp(info, "no") != 0) { + if ((info = (char *)sym_get(keys, key_get)) != NULL) + if (strcmp(info, "no") != 0) { test_result(tag, NULL, NULL, "coredump", keys); } strcpy(key_get, "termination_type"); - if((tt = (char *)sym_get(keys, key_get))==NULL) { + if ((tt = (char *)sym_get(keys, key_get))==NULL) { test_result(tag, NULL, NULL, "no Term Type", keys); return -1; } - if(strcmp(tt, "exited")) { + if (strcmp(tt, "exited")) { test_result(tag, NULL, NULL, tt, keys); } strcpy(key_get, "analysis"); - if((info = (char *)sym_get(keys, key_get)) == NULL) { + if ((info = (char *)sym_get(keys, key_get)) == NULL) { test_result(tag, NULL, NULL, "no Analysis Type", keys); return -1; } @@ -284,25 +284,25 @@ tag_report(alltags, ctag, keys) * errors. Do the kind of reporting requested by the test. */ - if(strncmp(info, "none", 4) == 0 ) { + if (strncmp(info, "none", 4) == 0) { /* * If analysis is 'none', alway report the test as * a pass regardless of output or exit status. */ test_result(tag, NULL, NULL, "pass", keys); - } else if(strncmp(info, "cuts", 4)) { + } else if (strncmp(info, "cuts", 4)) { /* * If analysis is not cuts, assume it is 'exit', thus * the termination_id is used to determine pass/fail result. */ - if ( strcmp(tt, "timeout") ) { + if (strcmp(tt, "timeout")) { strcpy(key_get, "termination_id"); - if((info = (char *)sym_get(keys, key_get)) == NULL) { + if ((info = (char *)sym_get(keys, key_get)) == NULL) { test_result(tag, NULL, NULL, "no_Term_Id", keys); } else { - if(strcmp(info, "0")) { + if (strcmp(info, "0")) { test_result(tag, NULL, NULL, "fail", keys); } else { test_result(tag, NULL, NULL, "pass", keys); @@ -328,40 +328,40 @@ tag_report(alltags, ctag, keys) * End Line */ - if(extended) { + if (extended) { strcpy(key_get, "termination_id"); - if((ti = (char *)sym_get(keys, key_get)) == NULL) { + if ((ti = (char *)sym_get(keys, key_get)) == NULL) { ti = "No_Termination_ID"; } strcpy(key_get, "termination_type"); - if((tt = (char *)sym_get(keys, key_get)) == NULL) { + if ((tt = (char *)sym_get(keys, key_get)) == NULL) { tt = "No_Termination_Type"; } strcpy(key_get, "duration"); - if((duration = (char *)sym_get(keys, key_get)) == NULL) { + if ((duration = (char *)sym_get(keys, key_get)) == NULL) { duration = "No_Duration"; } strcpy(key_get, "_Start_line"); - if((sl = (char *)sym_get(keys, key_get)) == NULL) { + if ((sl = (char *)sym_get(keys, key_get)) == NULL) { sl = "No_Start_line"; } strcpy(key_get, "_End_line"); - if((el = (char *)sym_get(keys, key_get)) == NULL) { + if ((el = (char *)sym_get(keys, key_get)) == NULL) { el = "No_End_line"; } strcpy(key_get, "contacts"); - if((contact = (char *)sym_get(keys, key_get)) == NULL) { + if ((contact = (char *)sym_get(keys, key_get)) == NULL) { contact = "No_Contacts"; } strcpy(key_get, "stime"); - if((mystime = (char *)sym_get(keys, key_get)) == NULL) { + if ((mystime = (char *)sym_get(keys, key_get)) == NULL) { mystime = "No_stime"; } @@ -388,7 +388,7 @@ print_header(tags) extern int extended; - if(extended) + if (extended) out = stderr; else out = stdout; @@ -397,12 +397,12 @@ print_header(tags) /* build header out of RTS keywords */ sprintf(key_get, "_RTS"); Key.data = (void *) key_get; - if(sym_seq(tags, &Key, &Data, R_CURSOR) == 0) { + if (sym_seq(tags, &Key, &Data, R_CURSOR) == 0) { do { - if(strcmp((char *)Key.data, "PATH")==0) + if (strcmp((char *)Key.data, "PATH")==0) continue; fprintf(out, "%-20.20s %s\n", (char *)Key.data, (char *)Data.data); - } while(sym_seq(tags, &Key, &Data, R_NEXT)==0); + } while (sym_seq(tags, &Key, &Data, R_NEXT)==0); } fprintf(out, "\n"); @@ -429,7 +429,7 @@ cuts_testcase(tag, keys) extern char yytext[]; cuts_info[tok_num] = strtok(yytext, "\t "); - while(tok_num < 5 && + while (tok_num < 5 && (cuts_info[++tok_num] = strtok(NULL, "\t ")) != NULL ) ; @@ -445,7 +445,7 @@ cuts_testcase(tag, keys) } #endif - if((oldresult=(char *)sym_get(tag, key)) != NULL) { + if ((oldresult=(char *)sym_get(tag, key)) != NULL) { /* Duplicate -- assume mulitple runs */ /* keep "worst case" */ newresult = worst_case(oldresult, cuts_info[2]); @@ -474,13 +474,13 @@ worst_case(t1, t2) /* Search the table for each status, then use the index to determine which has a lower precedence */ - for(w1=worst; *w1 != NULL && strcmp(t1,*w1); w1++) + for (w1=worst; *w1 != NULL && strcmp(t1,*w1); w1++) ; - for(w2=worst; *w2 != NULL && strcmp(t2,*w2); w2++) + for (w2=worst; *w2 != NULL && strcmp(t2,*w2); w2++) ; - if(w1 < w2) + if (w1 < w2) return(t1); else return(t2); diff --git a/pan/zoolib.c b/pan/zoolib.c index 8f7bf6f07..1685b947a 100644 --- a/pan/zoolib.c +++ b/pan/zoolib.c @@ -260,7 +260,7 @@ zoo_clear(zoo_t z, pid_t p) if (zoo_unlock(z)) return -1; - if(!found) { + if (!found) { snprintf(zoo_error, ZELEN, "zoo_clear() did not find pid(%d)", p); @@ -387,12 +387,12 @@ cat_args(int argc, char **argv) int a, size; char *cmd; - for( size = a = 0; a < argc; a++) { + for (size = a = 0; a < argc; a++) { size += strlen(argv[a]); size++; } - if( (cmd = (char *)malloc(size)) == NULL ) { + if ((cmd = (char *)malloc(size)) == NULL) { snprintf(zoo_error, ZELEN, "Malloc Error, %s/%d", __FILE__, __LINE__); @@ -400,8 +400,8 @@ cat_args(int argc, char **argv) } *cmd='\0'; - for(a = 0; a < argc ; a++) { - if(a != 0) + for (a = 0; a < argc ; a++) { + if (a != 0) strcat(cmd, " "); strcat(cmd, argv[a]); } @@ -450,12 +450,12 @@ main(int argc, char *argv[]) zoo_mark_args(test_zoo, getpid(), test_tag, argc, argv); - for(j = 0; j < 5; j++) { - for(i = 0; i < 20; i++) { + for (j = 0; j < 5; j++) { + for (i = 0; i < 20; i++) { zt_add(test_zoo, i); } - for(; i >=0; i--) { + for (; i >=0; i--) { zoo_clear(test_zoo, i); } } |