string-util: when ellipsizing to a length if (size_t) -1, become a NOP
authorLennart Poettering <lennart@poettering.net>
Fri, 10 Nov 2017 20:41:53 +0000 (21:41 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Nov 2017 20:41:53 +0000 (21:41 +0100)
commitddbc931986bac931a07a1aeb507a1a30153ac7ed
tree284a140b9663460ea5f16d396f967cd4662f1c12
parent459b9f9ff7852144cf3ba380d9374acb3d46b328
string-util: when ellipsizing to a length if (size_t) -1, become a NOP

Let's say that (size_t) -1 (i.e. SIZE_T_MAX) is equivalent to
"unbounded" ellipsation, i.e. ellipsation as NOP. In which case the
relevant functions become little more than strdup()/strndup().

This is useful to simplify caller code in case we want to turn off
ellipsation in certain code paths with minimal caller-side handling for
this.
src/basic/string-util.c