diff options
Diffstat (limited to 'scripts/kconfig')
| -rw-r--r-- | scripts/kconfig/confdata.c | 2 | ||||
| -rw-r--r-- | scripts/kconfig/kxgettext.c | 2 | ||||
| -rw-r--r-- | scripts/kconfig/lkc.h | 1 | ||||
| -rwxr-xr-x | scripts/kconfig/lxdialog/check-lxdialog.sh | 3 | ||||
| -rw-r--r-- | scripts/kconfig/menu.c | 1 | ||||
| -rw-r--r-- | scripts/kconfig/symbol.c | 4 | ||||
| -rw-r--r-- | scripts/kconfig/util.c | 11 | ||||
| -rw-r--r-- | scripts/kconfig/zconf.l | 12 | ||||
| -rw-r--r-- | scripts/kconfig/zconf.y | 3 | 
9 files changed, 25 insertions, 14 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 5c12dc91ef34..df26c7b0fe13 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -178,7 +178,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)  	case S_HEX:  	done:  		if (sym_string_valid(sym, p)) { -			sym->def[def].val = strdup(p); +			sym->def[def].val = xstrdup(p);  			sym->flags |= def_flags;  		} else {  			if (def != S_DEF_AUTO) diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index 2858738b22d5..240880a89111 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c @@ -101,7 +101,7 @@ static struct message *message__new(const char *msg, char *option,  	if (self->files == NULL)  		goto out_fail; -	self->msg = strdup(msg); +	self->msg = xstrdup(msg);  	if (self->msg == NULL)  		goto out_fail_msg; diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 4e23febbe4b2..2d5ec2d0e952 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -115,6 +115,7 @@ int file_write_dep(const char *name);  void *xmalloc(size_t size);  void *xcalloc(size_t nmemb, size_t size);  void *xrealloc(void *p, size_t size); +char *xstrdup(const char *s);  struct gstr {  	size_t len; diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index a10bd9d6fafd..6c0bcd9c472d 100755 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -55,7 +55,8 @@ EOF  	    echo " *** required header files."                            1>&2  	    echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2  	    echo " *** "                                                  1>&2 -	    echo " *** Install ncurses (ncurses-devel) and try again."    1>&2 +	    echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2 +	    echo " *** depending on your distribution) and try again."    1>&2  	    echo " *** "                                                  1>&2  	    exit 1  	fi diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 99222855544c..36cd3e1f1c28 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -212,6 +212,7 @@ void menu_add_option(int token, char *arg)  			sym_defconfig_list = current_entry->sym;  		else if (sym_defconfig_list != current_entry->sym)  			zconf_error("trying to redefine defconfig symbol"); +		sym_defconfig_list->flags |= SYMBOL_AUTO;  		break;  	case T_OPT_ENV:  		prop_add_env(arg); diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index cca9663be5dd..2220bc4b051b 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -183,7 +183,7 @@ static void sym_validate_range(struct symbol *sym)  		sprintf(str, "%lld", val2);  	else  		sprintf(str, "0x%llx", val2); -	sym->curr.val = strdup(str); +	sym->curr.val = xstrdup(str);  }  static void sym_set_changed(struct symbol *sym) @@ -849,7 +849,7 @@ struct symbol *sym_lookup(const char *name, int flags)  				   : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))  				return symbol;  		} -		new_name = strdup(name); +		new_name = xstrdup(name);  	} else {  		new_name = NULL;  		hash = 0; diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index b98a79e30e04..c6f6e21b809f 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c @@ -154,3 +154,14 @@ void *xrealloc(void *p, size_t size)  	fprintf(stderr, "Out of memory.\n");  	exit(1);  } + +char *xstrdup(const char *s) +{ +	char *p; + +	p = strdup(s); +	if (p) +		return p; +	fprintf(stderr, "Out of memory.\n"); +	exit(1); +} diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 02de6fe302a9..88b650eb9cc9 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -332,16 +332,12 @@ void zconf_nextfile(const char *name)  				"Inclusion path:\n  current file : '%s'\n",  				zconf_curname(), zconf_lineno(),  				zconf_curname()); -			iter = current_file->parent; -			while (iter && \ -			       strcmp(iter->name,current_file->name)) { -				fprintf(stderr, "  included from: '%s:%d'\n", -					iter->name, iter->lineno-1); +			iter = current_file; +			do {  				iter = iter->parent; -			} -			if (iter)  				fprintf(stderr, "  included from: '%s:%d'\n", -					iter->name, iter->lineno+1); +					iter->name, iter->lineno - 1); +			} while (strcmp(iter->name, current_file->name));  			exit(1);  		}  	} diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 4be98050b961..ad6305b0f40c 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -127,7 +127,7 @@ no_mainmenu_stmt: /* empty */  	 * later regardless of whether it comes from the 'prompt' in  	 * mainmenu_stmt or here  	 */ -	menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL); +	menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL);  }; @@ -276,6 +276,7 @@ choice: T_CHOICE word_opt T_EOL  	sym->flags |= SYMBOL_AUTO;  	menu_add_entry(sym);  	menu_add_expr(P_CHOICE, NULL, NULL); +	free($2);  	printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());  };  | 

