summaryrefslogtreecommitdiff
path: root/src/strutil.c
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2024-02-17 00:38:57 +0100
committerLinnnus <[email protected]>2024-02-17 00:48:21 +0100
commitcd39c2a2fdf57b82fa8584cac3c201b8aafb72b5 (patch)
tree6809203eccbe7af52f422f711b9815c0f149927f /src/strutil.c
parentad937750d754676f8e9e01ce2c1021ad1a80ee04 (diff)
chore: avoid sign warnings
Diffstat (limited to 'src/strutil.c')
-rw-r--r--src/strutil.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/strutil.c b/src/strutil.c
index 46778ae..cf0fa68 100644
--- a/src/strutil.c
+++ b/src/strutil.c
@@ -82,13 +82,13 @@ char *replace(struct arena *a, const char *orig, const char *rep, const char *wi
char *tmp; // varies
- int len_rep = strlen(rep);
+ size_t len_rep = strlen(rep);
if (len_rep == 0) {
errno = EINVAL; // empty rep causes infinite loop during count
return NULL;
}
- int len_with;
+ size_t len_with;
if (with == NULL)
with = "";
len_with = strlen(with);
@@ -111,7 +111,7 @@ char *replace(struct arena *a, const char *orig, const char *rep, const char *wi
// orig points to the remainder of orig after "end of rep"
while (count--) {
ins = strstr(orig, rep);
- int len_front = ins - orig;
+ ssize_t len_front = ins - orig;
tmp = strncpy(tmp, orig, len_front) + len_front;
tmp = strcpy(tmp, with) + len_with;
orig += len_front + len_rep; // move to next "end of rep"