diff options
author | Zbigniew Chyla <zbigniew@chyla.pl> | 2015-01-16 15:46:59 +0100 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-01-21 10:47:35 -0500 |
commit | fca5b90829621e119a310225b4f1358cd6914d5c (patch) | |
tree | d45368bac641c99877370a2bf0e29828bd7a10df /strfuncs.h | |
parent | 4abdcf1ac9a891a5010f238214150adbc2073b38 (diff) | |
download | gpsd-fca5b90829621e119a310225b4f1358cd6914d5c.tar.gz |
Add str_rstrip_char, use it everywhere.
This change doesn't affect generated binary code.
Diffstat (limited to 'strfuncs.h')
-rw-r--r-- | strfuncs.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -19,4 +19,10 @@ #define str_vappendf(str, alloc_size, format, ap) \ ((void) vsnprintf((str) + strlen(str), (alloc_size) - strlen(str), (format), (ap))) +#define str_rstrip_char(str, ch) \ + do { \ + if ((str)[strlen(str) - 1] == ch) \ + (str)[strlen(str) - 1] = '\0'; \ + } while (0) + #endif /* _GPSD_STRFUNCS_H_ */ |