diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2016-10-21 16:12:39 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2016-10-21 16:12:39 +0000 |
commit | 592cb820f7b5663de0327a8159bcf94bdfc07d7b (patch) | |
tree | e2332e28851fed0cc38a84fe9af3f5620ebd1b62 | |
parent | 0d3cbdfe6b322cecc6a0bfefc504d9f5047e43b0 (diff) |
small obvious cleanups:
- remove a lot of unnecessary casts
- zap extra param that's no longer needed
- add proper prototype and make function static
okay natano@
-rw-r--r-- | usr.bin/make/arch.c | 6 | ||||
-rw-r--r-- | usr.bin/make/compat.c | 4 | ||||
-rw-r--r-- | usr.bin/make/cond.c | 4 | ||||
-rw-r--r-- | usr.bin/make/dir.c | 8 | ||||
-rw-r--r-- | usr.bin/make/direxpand.c | 7 | ||||
-rw-r--r-- | usr.bin/make/dump.c | 4 | ||||
-rw-r--r-- | usr.bin/make/engine.c | 6 | ||||
-rw-r--r-- | usr.bin/make/lowparse.c | 4 | ||||
-rw-r--r-- | usr.bin/make/main.c | 12 | ||||
-rw-r--r-- | usr.bin/make/make.c | 8 | ||||
-rw-r--r-- | usr.bin/make/parse.c | 17 | ||||
-rw-r--r-- | usr.bin/make/suff.c | 22 | ||||
-rw-r--r-- | usr.bin/make/targ.c | 4 | ||||
-rw-r--r-- | usr.bin/make/targequiv.c | 4 |
14 files changed, 54 insertions, 56 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 899a47245c9..fb65cc64843 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arch.c,v 1.86 2015/12/11 21:37:03 mmcc Exp $ */ +/* $OpenBSD: arch.c,v 1.87 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -320,7 +320,7 @@ parse_archive(Buffer expand, const char **linePtr, Lst nodeLst, SymTable *ctxt) Lst_Init(&members); Dir_Expandi(member, emember, defaultPath, &members); - while ((m = (char *)Lst_DeQueue(&members)) != NULL) { + while ((m = Lst_DeQueue(&members)) != NULL) { Buf_Addi(expand, lib, elib); Buf_AddChar(expand, '('); Buf_AddString(expand, m); @@ -875,7 +875,7 @@ Arch_MemMTime(GNode *gn) char *nameStart; char *nameEnd; - pgn = (GNode *)Lst_Datum(ln); + pgn = Lst_Datum(ln); if (pgn->type & OP_ARCHV) { /* If the parent is an archive specification and is diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index d546f9f86d4..b4fceb7dda7 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat.c,v 1.85 2015/01/23 13:38:16 espie Exp $ */ +/* $OpenBSD: compat.c,v 1.86 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */ /* @@ -283,7 +283,7 @@ Compat_Run(Lst targs) /* List of target nodes to re-create */ * inferiors could not be made due to errors. */ errors = 0; - while ((gn = (GNode *)Lst_DeQueue(targs)) != NULL) { + while ((gn = Lst_DeQueue(targs)) != NULL) { CompatMake(gn, NULL); if (gn->built_status == UPTODATE) diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index f024a6d0c10..588784284b1 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cond.c,v 1.50 2013/11/22 15:47:35 espie Exp $ */ +/* $OpenBSD: cond.c,v 1.51 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */ /* @@ -269,7 +269,7 @@ CondDoMake(struct Name *arg) LstNode ln; for (ln = Lst_First(create); ln != NULL; ln = Lst_Adv(ln)) { - char *s = (char *)Lst_Datum(ln); + char *s = Lst_Datum(ln); if (Str_Matchi(s, strchr(s, '\0'), arg->s, arg->e)) return true; } diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index 279191c3c0a..7e820f8a7fe 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.67 2015/01/23 22:35:57 espie Exp $ */ +/* $OpenBSD: dir.c,v 1.68 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */ /* @@ -459,7 +459,7 @@ Dir_FindFileComplexi(const char *name, const char *ename, Lst path, * If found, we concatenate the directory name and the * final component and return the resulting string. */ for (ln = Lst_First(path); ln != NULL; ln = Lst_Adv(ln)) { - p = (struct PathEntry *)Lst_Datum(ln); + p = Lst_Datum(ln); if (DEBUG(DIR)) printf("%s...", p->name); if (find_file_hashi(p, basename, ename, hv) != NULL) { @@ -533,7 +533,7 @@ Dir_FindFileComplexi(const char *name, const char *ename, Lst path, if (DEBUG(DIR)) printf("failed. Trying subdirectories..."); for (ln = Lst_First(path); ln != NULL; ln = Lst_Adv(ln)) { - p = (struct PathEntry *)Lst_Datum(ln); + p = Lst_Datum(ln); if (p != dot) file = Str_concati(p->name, strchr(p->name, '\0'), name, ename, '/'); @@ -677,7 +677,7 @@ Dir_Concat(Lst path1, Lst path2) struct PathEntry *p; for (ln = Lst_First(path2); ln != NULL; ln = Lst_Adv(ln)) { - p = (struct PathEntry *)Lst_Datum(ln); + p = Lst_Datum(ln); if (Lst_AddNew(path1, p)) p->refCount++; } diff --git a/usr.bin/make/direxpand.c b/usr.bin/make/direxpand.c index 596af24fb79..3335e8cfe25 100644 --- a/usr.bin/make/direxpand.c +++ b/usr.bin/make/direxpand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: direxpand.c,v 1.7 2015/01/23 22:35:57 espie Exp $ */ +/* $OpenBSD: direxpand.c,v 1.8 2016/10/21 16:12:38 espie Exp $ */ /* * Copyright (c) 1999,2007 Marc Espie. * @@ -95,8 +95,7 @@ PathMatchFilesi(const char *word, const char *eword, Lst path, Lst expansions) LstNode ln; /* Current node */ for (ln = Lst_First(path); ln != NULL; ln = Lst_Adv(ln)) - Dir_MatchFilesi(word, eword, (struct PathEntry *)Lst_Datum(ln), - expansions); + Dir_MatchFilesi(word, eword, Lst_Datum(ln), expansions); } /*- @@ -200,7 +199,7 @@ DirExpandCurlyi(const char *word, const char *eword, Lst path, Lst expansions) /* Prime queue with copy of initial word */ Lst_Init(&curled); Lst_EnQueue(&curled, Str_dupi(word, eword)); - while ((toexpand = (char *)Lst_DeQueue(&curled)) != NULL) { + while ((toexpand = Lst_DeQueue(&curled)) != NULL) { const char *brace; const char *start; /* Start of current chunk of brace clause */ diff --git a/usr.bin/make/dump.c b/usr.bin/make/dump.c index c661d5a01bd..82779cedec8 100644 --- a/usr.bin/make/dump.c +++ b/usr.bin/make/dump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dump.c,v 1.8 2015/01/23 22:35:57 espie Exp $ */ +/* $OpenBSD: dump.c,v 1.9 2016/10/21 16:12:38 espie Exp $ */ /* * Copyright (c) 2012 Marc Espie. * @@ -156,7 +156,7 @@ TargPrintNode(GNode *gn, bool full) LstNode ln; for (ln = Lst_First(&gn->cohorts); ln != NULL; ln = Lst_Adv(ln)) - TargPrintNode((GNode *)Lst_Datum(ln), full); + TargPrintNode(Lst_Datum(ln), full); } } diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c index 734135efe37..688d26ecb32 100644 --- a/usr.bin/make/engine.c +++ b/usr.bin/make/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.50 2015/01/23 13:18:40 espie Exp $ */ +/* $OpenBSD: engine.c,v 1.51 2016/10/21 16:12:38 espie Exp $ */ /* * Copyright (c) 2012 Marc Espie. * @@ -308,7 +308,7 @@ Make_HandleUse(GNode *cgn, /* The .USE node */ for (ln = Lst_First(&cgn->children); ln != NULL; ln = Lst_Adv(ln)) { - gn = (GNode *)Lst_Datum(ln); + gn = Lst_Datum(ln); if (Lst_AddNew(&pgn->children, gn)) { Lst_AtEnd(&gn->parents, pgn); @@ -351,7 +351,7 @@ Make_DoAllVar(GNode *gn) Var(ALLSRC_INDEX, gn) = ""; for (ln = Lst_First(&gn->children); ln != NULL; ln = Lst_Adv(ln)) { - child = (GNode *)Lst_Datum(ln); + child = Lst_Datum(ln); if ((child->type & (OP_EXEC|OP_USE|OP_INVISIBLE)) != 0) continue; if (OP_NOP(child->type) || diff --git a/usr.bin/make/lowparse.c b/usr.bin/make/lowparse.c index 51d5fcd9afb..54f0f95a7d7 100644 --- a/usr.bin/make/lowparse.c +++ b/usr.bin/make/lowparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lowparse.c,v 1.34 2015/12/05 18:31:17 espie Exp $ */ +/* $OpenBSD: lowparse.c,v 1.35 2016/10/21 16:12:38 espie Exp $ */ /* low-level parsing functions. */ @@ -223,7 +223,7 @@ Parse_NextFile(void) { if (current != NULL) free_input_stream(current); - current = (struct input_stream *)Lst_Pop(&input_stack); + current = Lst_Pop(&input_stack); return current != NULL; } diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index be4f93c97e9..b5d2f1894dc 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.120 2016/10/12 00:31:06 tb Exp $ */ +/* $OpenBSD: main.c,v 1.121 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */ /* @@ -105,7 +105,7 @@ static char *figure_out_MACHINE_CPU(void); static char *chdir_verify_path(const char *, struct dirs *); static char *figure_out_CURDIR(void); -static void setup_CURDIR_OBJDIR(struct dirs *, const char *); +static void setup_CURDIR_OBJDIR(struct dirs *); static void setup_VPATH(void); @@ -544,7 +544,7 @@ chdir_verify_path(const char *path, struct dirs *d) } static void -setup_CURDIR_OBJDIR(struct dirs *d, const char *machine) +setup_CURDIR_OBJDIR(struct dirs *d) { char *path; @@ -656,7 +656,7 @@ main(int argc, char **argv) bool read_depend = true;/* false if we don't want to read .depend */ MainParseChdir(argc, argv); - setup_CURDIR_OBJDIR(&d, machine); + setup_CURDIR_OBJDIR(&d); esetenv("PWD", d.object); unsetenv("CDPATH"); @@ -736,7 +736,7 @@ main(int argc, char **argv) LstNode ln; for (ln = Lst_First(create); ln != NULL; ln = Lst_Adv(ln)) { - char *name = (char *)Lst_Datum(ln); + char *name = Lst_Datum(ln); if (strcmp(name, "depend") == 0) read_depend = false; @@ -782,7 +782,7 @@ main(int argc, char **argv) for (ln = Lst_First(&varstoprint); ln != NULL; ln = Lst_Adv(ln)) { - char *value = Var_Value((char *)Lst_Datum(ln)); + char *value = Var_Value(Lst_Datum(ln)); printf("%s\n", value ? value : ""); } diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index 037ca27de01..f3423e5ab74 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $OpenBSD: make.c,v 1.70 2015/08/21 02:19:49 jsg Exp $ */ +/* $OpenBSD: make.c,v 1.71 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* @@ -159,7 +159,7 @@ has_unmade_predecessor(GNode *gn) for (ln = Lst_First(&gn->preds); ln != NULL; ln = Lst_Adv(ln)) { - GNode *pgn = (GNode *)Lst_Datum(ln); + GNode *pgn = Lst_Datum(ln); if (pgn->must_make && pgn->built_status == UNKNOWN) { if (DEBUG(MAKE)) @@ -180,7 +180,7 @@ requeue_successors(GNode *gn) * queue, it means we need to place it in the queue as it restrained * itself before. */ for (ln = Lst_First(&gn->successors); ln != NULL; ln = Lst_Adv(ln)) { - GNode *succ = (GNode *)Lst_Datum(ln); + GNode *succ = Lst_Datum(ln); if (succ->must_make && succ->unmade == 0 && succ->built_status == UNKNOWN) @@ -263,7 +263,7 @@ Make_Update(GNode *cgn) /* the child node */ requeue(cgn); /* SIB: this is where I should mark the build as finished */ for (ln = Lst_First(&cgn->parents); ln != NULL; ln = Lst_Adv(ln)) { - pgn = (GNode *)Lst_Datum(ln); + pgn = Lst_Datum(ln); /* SIB: there should be a siblings loop there */ pgn->unmade--; if (pgn->must_make) { diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 882e3cbe2f8..ce6f424f8fd 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.116 2016/05/13 12:18:11 espie Exp $ */ +/* $OpenBSD: parse.c,v 1.117 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -148,6 +148,7 @@ static bool handle_for_loop(Buffer, const char *); static bool handle_undef(const char *); #define ParseReadLoopLine(linebuf) Parse_ReadUnparsedLine(linebuf, "for loop") static bool handle_bsd_command(Buffer, Buffer, const char *); +static bool register_target(GNode *, struct ohash *); static char *strip_comments(Buffer, const char *); static char *resolve_include_filename(const char *, const char *, bool); static void handle_include_file(const char *, const char *, bool, bool); @@ -326,7 +327,7 @@ ParseDoOp(GNode **gnp, unsigned int op) * tend to do anything with their local variables, but better * safe than sorry. */ for (ln = Lst_First(&gn->parents); ln != NULL; ln = Lst_Adv(ln)) - ParseLinkSrc((GNode *)Lst_Datum(ln), cohort); + ParseLinkSrc(Lst_Datum(ln), cohort); cohort->type = OP_DOUBLEDEP|OP_INVISIBLE; Lst_AtEnd(&gn->cohorts, cohort); @@ -455,8 +456,7 @@ ParseDoSrc( for (ln=Lst_First(&gn->cohorts); ln != NULL; ln = Lst_Adv(ln)){ - apply_op(targets, tOp, - (GNode *)Lst_Datum(ln)); + apply_op(targets, tOp, Lst_Datum(ln)); } } break; @@ -544,7 +544,7 @@ add_target_nodes(const char *line, const char *end) Lst_Init(&curTargs); Dir_Expandi(line, end, &emptyPath, &curTargs); Lst_Destroy(&emptyPath, Dir_Destroy); - while ((targName = (char *)Lst_DeQueue(&curTargs)) != NULL) { + while ((targName = Lst_DeQueue(&curTargs)) != NULL) { add_target_node(targName, targName + strlen(targName)); } Lst_Destroy(&curTargs, NOFREE); @@ -919,7 +919,7 @@ ParseDoDependency(const char *line) /* the line to parse */ for (ln = Lst_First(&paths); ln != NULL; ln = Lst_Adv(ln)) - Dir_AddDiri((Lst)Lst_Datum(ln), line, cp); + Dir_AddDiri(Lst_Datum(ln), line, cp); break; } default: @@ -967,8 +967,7 @@ ParseDoDependency(const char *line) /* the line to parse */ return; } - while ((gn = (GNode *)Lst_DeQueue(&sources)) != - NULL) + while ((gn = Lst_DeQueue(&sources)) != NULL) ParseDoSrc(>argets, &gsources, tOp, gn->name, NULL); cp = line; @@ -1405,7 +1404,7 @@ handle_bsd_command(Buffer linebuf, Buffer copy, const char *line) } /* postprocess group of targets prior to linking stuff with them */ -bool +static bool register_target(GNode *gn, struct ohash *t) { unsigned int slot; diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index a78f680e55d..c6923861ff0 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: suff.c,v 1.90 2015/01/23 22:35:58 espie Exp $ */ +/* $OpenBSD: suff.c,v 1.91 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -328,7 +328,7 @@ SuffInsert(Lst l, Suff *s) Suff *s2 = NULL; /* the suffix descriptor in this element */ for (ln = Lst_First(l); ln != NULL; ln = Lst_Adv(ln)) { - s2 = (Suff *)Lst_Datum(ln); + s2 = Lst_Datum(ln); if (s2->order >= s->order) break; } @@ -754,7 +754,7 @@ SuffRemoveSrc(Lst l) for (ln = Lst_First(l); ln != NULL; ln = Lst_Adv(ln)) { - s = (Src *)Lst_Datum(ln); + s = Lst_Datum(ln); if (s->children == 0) { free(s->file); if (!s->parent) @@ -808,7 +808,7 @@ SuffFindThem( rs = NULL; - while ((s = (Src *)Lst_DeQueue(srcs)) != NULL) { + while ((s = Lst_DeQueue(srcs)) != NULL) { if (DEBUG(SUFF)) printf("\ttrying %s...", s->file); @@ -869,7 +869,7 @@ SuffFindCmds(Src *targ, Lst slst) prefixLen = strlen(targ->prefix); for (ln = Lst_First(&t->children); ln != NULL; ln = Lst_Adv(ln)) { - s = (GNode *)Lst_Datum(ln); + s = Lst_Datum(ln); cp = strrchr(s->name, '/'); if (cp == NULL) @@ -1001,7 +1001,7 @@ SuffExpandVarChildren(LstNode after, GNode *cgn, GNode *pgn) } } /* Add all elements of the members list to the parent node. */ - while ((gn = (GNode *)Lst_DeQueue(&members)) != NULL) { + while ((gn = Lst_DeQueue(&members)) != NULL) { if (DEBUG(SUFF)) printf("%s...", gn->name); if (Lst_Member(&pgn->children, gn) == NULL) { @@ -1049,7 +1049,7 @@ SuffExpandWildChildren(LstNode after, GNode *cgn, GNode *pgn) Dir_Expand(cgn->name, path, &exp); /* Fetch next expansion off the list and find its GNode. */ - while ((cp = (char *)Lst_DeQueue(&exp)) != NULL) { + while ((cp = Lst_DeQueue(&exp)) != NULL) { GNode *gn; /* New source 8) */ if (DEBUG(SUFF)) printf("%s...", cp); @@ -1084,7 +1084,7 @@ static void SuffExpandChildren(LstNode ln, /* LstNode of child, so we can replace it */ GNode *pgn) { - GNode *cgn = (GNode *)Lst_Datum(ln); + GNode *cgn = Lst_Datum(ln); /* First do variable expansion -- this takes precedence over wildcard * expansion. If the result contains wildcards, they'll be gotten to @@ -1155,7 +1155,7 @@ SuffApplyTransform( * only one implied src, as that will be sufficient to get * the .IMPSRC variable set for tGn. */ for (ln=Lst_First(&sGn->cohorts); ln != NULL; ln=Lst_Adv(ln)) { - gn = (GNode *)Lst_Datum(ln); + gn = Lst_Datum(ln); if (Lst_AddNew(&tGn->children, gn)) { /* Not already linked, so form the proper links @@ -1204,7 +1204,7 @@ find_suffix_as_suffix(Lst l, const char *b, const char *e) Suff *s; for (ln = Lst_First(l); ln != NULL; ln = Lst_Adv(ln)) { - s = (Suff *)Lst_Datum(ln); + s = Lst_Datum(ln); if (suffix_is_suffix(s, b, e)) return s; } @@ -1449,7 +1449,7 @@ SuffFindNormalDeps( /* No known transformations -- use the first suffix found for * setting the local variables. */ if (!Lst_IsEmpty(&targs)) - targ = (Src *)Lst_Datum(Lst_First(&targs)); + targ = Lst_Datum(Lst_First(&targs)); else targ = NULL; } else { diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index e1baa194eca..df4712ef9bf 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targ.c,v 1.76 2015/01/23 22:35:58 espie Exp $ */ +/* $OpenBSD: targ.c,v 1.77 2016/10/21 16:12:38 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* @@ -215,7 +215,7 @@ Targ_FindList(Lst nodes, Lst names) char *name; for (ln = Lst_First(names); ln != NULL; ln = Lst_Adv(ln)) { - name = (char *)Lst_Datum(ln); + name = Lst_Datum(ln); gn = Targ_FindNode(name, TARG_CREATE); /* Note: Lst_AtEnd must come before the Lst_Concat so the nodes * are added to the list in the order in which they were diff --git a/usr.bin/make/targequiv.c b/usr.bin/make/targequiv.c index 8ab5d67b8eb..2aa22e04d21 100644 --- a/usr.bin/make/targequiv.c +++ b/usr.bin/make/targequiv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targequiv.c,v 1.7 2015/01/16 15:36:30 deraadt Exp $ */ +/* $OpenBSD: targequiv.c,v 1.8 2016/10/21 16:12:38 espie Exp $ */ /* * Copyright (c) 2007-2008 Marc Espie. * @@ -165,7 +165,7 @@ kludge_look_harder_for_target(GNode *gn) Lst_Concat(&gn->commands, &extra->commands); for (ln = Lst_First(&extra->children); ln != NULL; ln = Lst_Adv(ln)) { - cgn = (GNode *)Lst_Datum(ln); + cgn = Lst_Datum(ln); if (Lst_AddNew(&gn->children, cgn)) { Lst_AtEnd(&cgn->parents, gn); |