context: make error line debug a little better
Make a line to the ^ so that it is more visible. Spell out column completely. Make the sizes a little smaller to avoid awkward gaps.
This commit is contained in:
parent
a9fdc6a408
commit
a0af514581
|
@ -35,7 +35,7 @@ struct spa_debug_context {
|
|||
static inline void spa_debugc_error_location(struct spa_debug_context *c,
|
||||
struct spa_error_location *loc)
|
||||
{
|
||||
int i, skip = loc->col > 80 ? loc->col - 40 : 0;
|
||||
int i, skip = loc->col > 80 ? loc->col - 40 : 0, lc = loc->col-skip-1;
|
||||
char buf[80];
|
||||
|
||||
for (i = 0; (size_t)i < sizeof(buf)-1; i++) {
|
||||
|
@ -45,10 +45,10 @@ static inline void spa_debugc_error_location(struct spa_debug_context *c,
|
|||
buf[i] = isspace(ch) ? ' ' : ch;
|
||||
}
|
||||
buf[i] = '\0';
|
||||
spa_debugc(c, "line: %6d | %s%s", loc->line, skip ? "..." : "", buf);
|
||||
spa_debugc(c, "line:%6d | %s%s", loc->line, skip ? "..." : "", buf);
|
||||
for (i = 0; buf[i]; i++)
|
||||
buf[i] = i+skip+1 == loc->col ? '^' : ' ';
|
||||
spa_debugc(c, "col: %6d | %s%s", loc->col, skip ? " " : "", buf);
|
||||
buf[i] = i < lc ? '-' : i == lc ? '^' : ' ';
|
||||
spa_debugc(c, "column:%4d |-%s%s", loc->col, skip ? "---" : "", buf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue