X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=blobdiff_plain;f=config%2Futil.c;fp=config%2Futil.c;h=703ee490461319434ebddba318702c85a9c48e60;hp=c6f6e21b809ffe7a6f60acd2a7f016ee88971d5c;hb=bd5e9f6c34b6396318f6214c60cc827290830e5f;hpb=001b488249ed961ee66e61dccf23866b8d7f8dbd diff --git a/config/util.c b/config/util.c index c6f6e21..703ee49 100644 --- a/config/util.c +++ b/config/util.c @@ -34,8 +34,6 @@ struct file *file_lookup(const char *name) /* write a dependency file as used by kbuild to track dependencies */ int file_write_dep(const char *name) { - struct symbol *sym, *env_sym; - struct expr *e; struct file *file; FILE *out; @@ -54,21 +52,7 @@ int file_write_dep(const char *name) fprintf(out, "\n%s: \\\n" "\t$(deps_config)\n\n", conf_get_autoconfig_name()); - expr_list_for_each_sym(sym_env_list, e, sym) { - struct property *prop; - const char *value; - - prop = sym_get_env_prop(sym); - env_sym = prop_get_symbol(prop); - if (!env_sym) - continue; - value = getenv(env_sym->name); - if (!value) - value = ""; - fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); - fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name()); - fprintf(out, "endif\n"); - } + env_write_dep(out, conf_get_autoconfig_name()); fprintf(out, "\n$(deps_config): ;\n"); fclose(out); @@ -165,3 +149,14 @@ char *xstrdup(const char *s) fprintf(stderr, "Out of memory.\n"); exit(1); } + +char *xstrndup(const char *s, size_t n) +{ + char *p; + + p = strndup(s, n); + if (p) + return p; + fprintf(stderr, "Out of memory.\n"); + exit(1); +}