Page MenuHomeFreeBSD

D38274.diff
No OneTemporary

D38274.diff

diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
--- a/usr.sbin/config/config.h
+++ b/usr.sbin/config/config.h
@@ -35,12 +35,15 @@
/*
* Config.
*/
+#include <sys/cdefs.h> /* __BEGIN_DECLS/__END_DECLS */
#include <sys/types.h>
#include <sys/queue.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
+__BEGIN_DECLS
+
struct cfgfile {
STAILQ_ENTRY(cfgfile) cfg_next;
char *cfg_path;
@@ -190,6 +193,7 @@
void remember(const char *);
void moveifchanged(const char *, const char *);
int yylex(void);
+int yyparse(void);
void options(void);
void makefile(void);
void makeenv(void);
@@ -218,5 +222,7 @@
extern char *PREFIX; /* Config file name - for error messages */
extern char srcdir[]; /* root of the kernel source tree */
+__END_DECLS;
+
#define eq(a,b) (!strcmp(a,b))
#define ns(s) strdup(s)
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -105,10 +105,9 @@
static void kernconfdump(const char *);
static void badversion(void);
static void checkversion(void);
-extern int yyparse(void);
struct hdr_list {
- char *h_name;
+ const char *h_name;
struct hdr_list *h_next;
} *htab;
@@ -620,10 +619,12 @@
tsize = (size_t)from_sb.st_size;
if (!changed) {
- p = mmap(NULL, tsize, PROT_READ, MAP_SHARED, from_fd, (off_t)0);
+ p = (char *)mmap(NULL, tsize, PROT_READ, MAP_SHARED, from_fd,
+ (off_t)0);
if (p == MAP_FAILED)
err(EX_OSERR, "mmap %s", from_name);
- q = mmap(NULL, tsize, PROT_READ, MAP_SHARED, to_fd, (off_t)0);
+ q = (char *)mmap(NULL, tsize, PROT_READ, MAP_SHARED, to_fd,
+ (off_t)0);
if (q == MAP_FAILED)
err(EX_OSERR, "mmap %s", to_name);
@@ -688,7 +689,7 @@
void
remember(const char *file)
{
- char *s;
+ const char *s;
struct hdr_list *hl;
if ((s = strrchr(file, '/')) != NULL)
@@ -697,16 +698,16 @@
s = ns(file);
if (strchr(s, '_') && strncmp(s, "opt_", 4) != 0) {
- free(s);
+ free(__DECONST(char *, s));
return;
}
for (hl = htab; hl != NULL; hl = hl->h_next) {
if (eq(s, hl->h_name)) {
- free(s);
+ free(__DECONST(char *, s));
return;
}
}
- hl = calloc(1, sizeof(*hl));
+ hl = (struct hdr_list *)calloc(1, sizeof(*hl));
if (hl == NULL)
err(EXIT_FAILURE, "calloc");
hl->h_name = s;
@@ -740,7 +741,7 @@
if (fp == NULL)
err(EXIT_FAILURE, "fdopen() failed");
osz = 1024;
- o = calloc(1, osz);
+ o = (char *)calloc(1, osz);
if (o == NULL)
err(EXIT_FAILURE, "Couldn't allocate memory");
/* ELF note section header. */
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -392,9 +392,9 @@
struct file_list *tp;
struct device *dp;
struct opt *op;
- char *wd, *this, *compilewith, *depends, *clean, *warning;
+ char *wd, *rfile, *compilewith, *depends, *clean, *warning;
const char *objprefix;
- int compile, match, nreqs, std, filetype, not,
+ int compile, match, nreqs, std, filetype, negate,
imp_rule, no_ctfconvert, no_obj, before_depend, nowerror;
fp = fopen(fname, "r");
@@ -434,13 +434,13 @@
;
goto next;
}
- this = ns(wd);
+ rfile = ns(wd);
wd = get_word(fp);
if (wd == (char *)EOF)
return;
if (wd == NULL)
- errout("%s: No type for %s.\n", fname, this);
- tp = fl_lookup(this);
+ errout("%s: No type for %s.\n", fname, rfile);
+ tp = fl_lookup(rfile);
compile = 0;
match = 1;
nreqs = 0;
@@ -454,25 +454,25 @@
no_obj = 0;
before_depend = 0;
nowerror = 0;
- not = 0;
+ negate = 0;
filetype = NORMAL;
objprefix = "";
if (eq(wd, "standard"))
std = 1;
else if (!eq(wd, "optional"))
errout("%s: \"%s\" %s must be optional or standard\n",
- fname, wd, this);
+ fname, wd, rfile);
for (wd = get_word(fp); wd; wd = get_word(fp)) {
if (wd == (char *)EOF)
return;
if (eq(wd, "!")) {
- not = 1;
+ negate = 1;
continue;
}
if (eq(wd, "|")) {
if (nreqs == 0)
errout("%s: syntax error describing %s\n",
- fname, this);
+ fname, rfile);
compile += match;
match = 1;
nreqs = 0;
@@ -491,7 +491,7 @@
errout("%s: alternate rule required when "
"\"no-implicit-rule\" is specified for"
" %s.\n",
- fname, this);
+ fname, rfile);
imp_rule++;
continue;
}
@@ -503,7 +503,7 @@
wd = get_quoted_word(fp);
if (wd == (char *)EOF || wd == NULL)
errout("%s: %s missing dependency string.\n",
- fname, this);
+ fname, rfile);
depends = ns(wd);
continue;
}
@@ -511,7 +511,7 @@
wd = get_quoted_word(fp);
if (wd == (char *)EOF || wd == NULL)
errout("%s: %s missing clean file list.\n",
- fname, this);
+ fname, rfile);
clean = ns(wd);
continue;
}
@@ -519,7 +519,7 @@
wd = get_quoted_word(fp);
if (wd == (char *)EOF || wd == NULL)
errout("%s: %s missing compile command string.\n",
- fname, this);
+ fname, rfile);
compilewith = ns(wd);
continue;
}
@@ -527,7 +527,7 @@
wd = get_quoted_word(fp);
if (wd == (char *)EOF || wd == NULL)
errout("%s: %s missing warning text string.\n",
- fname, this);
+ fname, rfile);
warning = ns(wd);
continue;
}
@@ -535,7 +535,7 @@
wd = get_quoted_word(fp);
if (wd == (char *)EOF || wd == NULL)
errout("%s: %s missing object prefix string.\n",
- fname, this);
+ fname, rfile);
objprefix = ns(wd);
continue;
}
@@ -554,10 +554,10 @@
nreqs++;
if (std)
errout("standard entry %s has optional inclusion specifier %s!\n",
- this, wd);
+ rfile, wd);
STAILQ_FOREACH(dp, &dtab, d_next)
if (eq(dp->d_name, wd)) {
- if (not)
+ if (negate)
match = 0;
else
dp->d_done |= DEVDONE;
@@ -566,21 +566,21 @@
SLIST_FOREACH(op, &opt, op_next)
if (op->op_value == 0 &&
strcasecmp(op->op_name, wd) == 0) {
- if (not)
+ if (negate)
match = 0;
goto nextparam;
}
- match &= not;
+ match &= negate;
nextparam:;
- not = 0;
+ negate = 0;
}
compile += match;
if (compile && tp == NULL) {
if (std == 0 && nreqs == 0)
errout("%s: what is %s optional on?\n",
- fname, this);
+ fname, rfile);
tp = new_fent();
- tp->f_fn = this;
+ tp->f_fn = rfile;
tp->f_type = filetype;
if (filetype == LOCAL)
tp->f_srcprefix = "";
diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c
--- a/usr.sbin/config/mkoptions.c
+++ b/usr.sbin/config/mkoptions.c
@@ -312,41 +312,41 @@
static void
-check_duplicate(const char *fname, const char *this)
+check_duplicate(const char *fname, const char *chkopt)
{
struct opt_list *po;
SLIST_FOREACH(po, &otab, o_next) {
- if (eq(po->o_name, this)) {
+ if (eq(po->o_name, chkopt)) {
fprintf(stderr, "%s: Duplicate option %s.\n",
- fname, this);
+ fname, chkopt);
exit(1);
}
}
}
static void
-insert_option(const char *fname, char *this, char *val)
+insert_option(const char *fname, char *optname, char *val)
{
struct opt_list *po;
- check_duplicate(fname, this);
+ check_duplicate(fname, optname);
po = (struct opt_list *) calloc(1, sizeof *po);
if (po == NULL)
err(EXIT_FAILURE, "calloc");
- po->o_name = this;
+ po->o_name = optname;
po->o_file = val;
po->o_flags = 0;
SLIST_INSERT_HEAD(&otab, po, o_next);
}
static void
-update_option(const char *this, char *val, int flags)
+update_option(const char *optname, char *val, int flags)
{
struct opt_list *po;
SLIST_FOREACH(po, &otab, o_next) {
- if (eq(po->o_name, this)) {
+ if (eq(po->o_name, optname)) {
free(po->o_file);
po->o_file = val;
po->o_flags = flags;
@@ -364,7 +364,7 @@
read_option_file(const char *fname, int flags)
{
FILE *fp;
- char *wd, *this, *val;
+ char *wd, *optname, *val;
char genopt[MAXPATHLEN];
fp = fopen(fname, "r");
@@ -378,17 +378,17 @@
continue;
continue;
}
- this = ns(wd);
+ optname = ns(wd);
val = get_word(fp);
if (val == (char *)EOF)
return (1);
if (val == NULL) {
if (flags) {
fprintf(stderr, "%s: compat file requires two"
- " words per line at %s\n", fname, this);
+ " words per line at %s\n", fname, optname);
exit(1);
}
- char *s = ns(this);
+ char *s = ns(optname);
(void)snprintf(genopt, sizeof(genopt), "opt_%s.h",
lower(s));
val = genopt;
@@ -396,9 +396,9 @@
}
val = ns(val);
if (flags == 0)
- insert_option(fname, this, val);
+ insert_option(fname, optname, val);
else
- update_option(this, val, flags);
+ update_option(optname, val, flags);
}
(void)fclose(fp);
return (1);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 8:51 AM (20 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14656176
Default Alt Text
D38274.diff (8 KB)

Event Timeline