MCPcopy Create free account
hub / github.com/coreboot/coreboot / expr_print_gstr_helper

Function expr_print_gstr_helper

util/kconfig/expr.c:1239–1267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1237}
1238
1239static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str)
1240{
1241 struct gstr *gs = (struct gstr*)data;
1242 const char *sym_str = NULL;
1243
1244 if (sym)
1245 sym_str = sym_get_string_value(sym);
1246
1247 if (gs->max_width) {
1248 unsigned extra_length = strlen(str);
1249 const char *last_cr = strrchr(gs->s, '\n');
1250 unsigned last_line_length;
1251
1252 if (sym_str)
1253 extra_length += 4 + strlen(sym_str);
1254
1255 if (!last_cr)
1256 last_cr = gs->s;
1257
1258 last_line_length = strlen(gs->s) - (last_cr - gs->s);
1259
1260 if ((last_line_length + extra_length) > gs->max_width)
1261 str_append(gs, "\\\n");
1262 }
1263
1264 str_append(gs, str);
1265 if (sym && sym->type != S_UNKNOWN)
1266 str_printf(gs, " [=%s]", sym_str);
1267}
1268
1269void expr_gstr_print(struct expr *e, struct gstr *gs)
1270{

Callers

nothing calls this directly

Calls 5

sym_get_string_valueFunction · 0.85
strlenFunction · 0.85
str_appendFunction · 0.85
str_printfFunction · 0.85
strrchrFunction · 0.50

Tested by

no test coverage detected