summaryrefslogtreecommitdiff
path: root/package/config/expr.c
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2010-09-02 17:08:11 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2010-09-02 17:08:11 +0200
commite62ed84b19d114870daf1f16aae177f60f9d6ad3 (patch)
tree9b3471d639525410bd65e36c5e5aa94b77c29a28 /package/config/expr.c
parent9bc12b85e83266c83f1fee0b9dd2d38e43d9252c (diff)
parent40177240fab04c710fd756a24816b451b37dc1b8 (diff)
Merge branch 'for-2010.11/kconfig-upgrade' of git://git.busybox.net/~tpetazzoni/git/buildroot
Diffstat (limited to 'package/config/expr.c')
-rw-r--r--package/config/expr.c33
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)