Age | Commit message (Collapse) | Author | Lines |
2022年11月07日 | fix strverscmp comparison of digit sequence with non-digits | Rich Felker | -3/+3 |
|
the rule that longest digit sequence not beginning with a zero is
greater only applies when both sequences being compared are
non-degenerate. this is spelled out explicitly in the man page, which
may be deemed authoritative for this nonstandard function: "If one or
both of these is empty, then return what strcmp(3) would have
returned..."
we were wrongly treating any sequence of digits not beginning with a
zero as greater than a non-digit in the other string.
|
2015年06月23日 | reimplement strverscmp to fix corner cases | Rich Felker | -32/+25 |
|
this interface is non-standardized and is a GNU invention, and as
such, our implementation should match the behavior of the GNU
function. one peculiarity the old implementation got wrong was the
handling of all-zero digit sequences: they are supposed to compare
greater than digit sequences of which they are a proper prefix, as in
009 < 00.
in addition, high bytes were treated with char signedness rather than
as unsigned. this was wrong regardless of what the GNU function does
since the resulting order relation varied by arch.
the new strverscmp implementation makes explicit the cases where the
order differs from what strcmp would produce, of which there are only
two.
|
2013年12月12日 | include cleanups: remove unused headers and add feature test macros | Szabolcs Nagy | -1/+0 |
|
2013年02月26日 | fix integer type issue in strverscmp | Rich Felker | -1/+3 |
|
lenl-lenr is not a valid expression for a signed int return value from
strverscmp, since after implicit conversion from size_t to int this
difference could have the wrong sign or might even be zero. using the
difference for char values works since they're bounded well within the
range of differences representable by int, but it does not work for
size_t values.
|
2013年02月26日 | implement non-stub strverscmp | Rich Felker | -2/+35 |
|
patch by Isaac Dunham.
|
2011年09月11日 | add dummied strverscmp (obnoxious GNU function) | Rich Felker | -0/+7 |
|
programs that use this tend to horribly botch international text
support, so it's questionable whether we want to support it even in
the long term... for now, it's just a dummy that calls strcmp.
|