Skip to content

Commit

Permalink
Return 0 for empty ranges, not 1 (empty string + nul byte).
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Aug 28, 2010
1 parent d60793f commit 66a8723
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion uri.c
Expand Up @@ -7,7 +7,10 @@

/* returns the number of chars required to store the range as a string, including the nul byte */
static int range_size(const UriTextRangeA *r) {
return r->first ? 1 + (r->afterLast - r->first) : 0;
if (r->first && r->first != r->afterLast) {
return 1 + (r->afterLast - r->first);
}
return 0;
}

/* returns the number of chars required to store the path, including the nul byte */
Expand Down

0 comments on commit 66a8723

Please sign in to comment.