diff options
| author | default <nobody@localhost> | 2025-01-12 16:21:20 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2025-01-12 16:21:20 +0100 |
| commit | ddc8781b3a93d77836b61f3efa884b3c23a1fd35 (patch) | |
| tree | 1b5678c398298df4b8bc439fb79827fcb5ce2ce4 /xs.h | |
| parent | 5aaa6192ef08de7ab6c63e85708a1c825e9ff5f1 (diff) | |
Minor improvements to start / end event time showing.
Diffstat (limited to 'xs.h')
| -rw-r--r-- | xs.h | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -626,15 +626,14 @@ int xs_between(const char *prefix, const char *str, const char *suffix) xs_str *xs_crop_i(xs_str *str, int start, int end) /* crops the string to be only from start to end */ { - XS_ASSERT_TYPE(str, XSTYPE_STRING); - int sz = strlen(str); if (end <= 0) end = sz + end; /* crop from the top */ - str[end] = '\0'; + if (end > 0 && end < sz) + str[end] = '\0'; /* crop from the bottom */ str = xs_collapse(str, 0, start); |