aboutsummaryrefslogtreecommitdiff
path: root/xs.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-01-12 16:21:20 +0100
committerdefault <nobody@localhost>2025-01-12 16:21:20 +0100
commitddc8781b3a93d77836b61f3efa884b3c23a1fd35 (patch)
tree1b5678c398298df4b8bc439fb79827fcb5ce2ce4 /xs.h
parent5aaa6192ef08de7ab6c63e85708a1c825e9ff5f1 (diff)
Minor improvements to start / end event time showing.
Diffstat (limited to 'xs.h')
-rw-r--r--xs.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/xs.h b/xs.h
index 45952c9..05d84f5 100644
--- a/xs.h
+++ b/xs.h
@@ -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);