diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2010-08-21 17:00:49 +0200 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2010-09-01 12:26:49 +0200 |
commit | 52a142a6314905422f14f05fccafdce35bea7f08 (patch) | |
tree | 8eeda1ea9da4aade3e64d06306140f523c289700 /package/config/expr.c | |
parent | 7c524dd0b683e1e8fac4e4084ac7678576bfbe07 (diff) |
Bump package/config to 2.6.36-rc1
The goal is to be able to use savedefconfig to generate minimal
defconfig files.
Four of our patches are removed since the modifications have been
merged upstream. The new nconf configuration utility has appeared.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/config/expr.c')
-rw-r--r-- | package/config/expr.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/package/config/expr.c b/package/config/expr.c index 392c7e94f..88aace9c9 100644 --- a/package/config/expr.c +++ b/package/config/expr.c @@ -348,7 +348,7 @@ struct expr *expr_trans_bool(struct expr *e) /* * e1 || e2 -> ? */ -struct expr *expr_join_or(struct expr *e1, struct expr *e2) +static struct expr *expr_join_or(struct expr *e1, struct expr *e2) { struct expr *tmp; struct symbol *sym1, *sym2; @@ -412,7 +412,7 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2) return NULL; } -struct expr *expr_join_and(struct expr *e1, struct expr *e2) +static struct expr *expr_join_and(struct expr *e1, struct expr *e2) { struct expr *tmp; struct symbol *sym1, *sym2; @@ -1087,7 +1087,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char * static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) { - fwrite(str, strlen(str), 1, data); + xfwrite(str, strlen(str), 1, data); } void expr_fprint(struct expr *e, FILE *out) @@ -1097,7 +1097,32 @@ void expr_fprint(struct expr *e, FILE *out) static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) { - str_append((struct gstr*)data, str); + struct gstr *gs = (struct gstr*)data; + const char *sym_str = NULL; + + if (sym) + sym_str = sym_get_string_value(sym); + + if (gs->max_width) { + unsigned extra_length = strlen(str); + const char *last_cr = strrchr(gs->s, '\n'); + unsigned last_line_length; + + if (sym_str) + extra_length += 4 + strlen(sym_str); + + if (!last_cr) + last_cr = gs->s; + + last_line_length = strlen(gs->s) - (last_cr - gs->s); + + if ((last_line_length + extra_length) > gs->max_width) + str_append(gs, "\\\n"); + } + + str_append(gs, str); + if (sym && sym->type != S_UNKNOWN) + str_printf(gs, " [=%s]", sym_str); } void expr_gstr_print(struct expr *e, struct gstr *gs) |