| 1237 | } |
| 1238 | |
| 1239 | static 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 | |
| 1269 | void expr_gstr_print(struct expr *e, struct gstr *gs) |
| 1270 | { |
nothing calls this directly
no test coverage detected