summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org>2019-06-05 13:39:34 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-06-05 13:39:34 (GMT)
commitf7b04cc09b26a7e1342170129dacf896f50f98b2 (patch) (side-by-side diff)
tree3eb2e559d136d0ea0802865527f217b79434f3c1 /src
parentb9e95e79712c1e0021e63204e0d910da2ec2692a (diff)
downloadgrecs-f7b04cc09b26a7e1342170129dacf896f50f98b2.tar.gz
grecs-f7b04cc09b26a7e1342170129dacf896f50f98b2.tar.bz2
Minor fix in location printer
* src/diag.c (grecs_asprint_locus): Handle the case where beg equals end.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/diag.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/diag.c b/src/diag.c
index db96e75..39089c4 100644
--- a/src/diag.c
+++ b/src/diag.c
@@ -96,11 +96,17 @@ grecs_asprint_locus(char **locstr, size_t *size, grecs_locus_t const *locus)
locus->beg.file,
locus->beg.line, locus->beg.col,
locus->end.line, locus->end.col);
- else
+ else if (locus->beg.col != locus->end.col)
rc = grecs_asprintf(locstr, size, "%s:%u.%u-%u",
locus->beg.file,
locus->beg.line, locus->beg.col,
locus->end.col);
+ else
+ rc = grecs_asprintf(locstr, size, "%s:%u.%u",
+ locus->beg.file,
+ locus->beg.line,
+ locus->beg.col);
+
return rc;
}

Return to:

Send suggestions and report system problems to the System administrator.