diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-24 01:49:27 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-24 01:49:27 +0200 |
commit | ca3b221b96a4d621c75f1e62aea74d6d83cadcd8 (patch) | |
tree | 35170b92ace9e6419871225928a410bc85968db6 /minecproxy | |
parent | 02afe960644466b8e3854f3bec48c03a294c1e35 (diff) |
Add STRLEN constant macro
Diffstat (limited to 'minecproxy')
-rw-r--r-- | minecproxy/idle.c | 2 | ||||
-rw-r--r-- | minecproxy/server.c | 2 | ||||
-rw-r--r-- | minecproxy/systemd.c | 6 | ||||
-rw-r--r-- | minecproxy/uring.c | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/minecproxy/idle.c b/minecproxy/idle.c index 90d7210..8fcb934 100644 --- a/minecproxy/idle.c +++ b/minecproxy/idle.c @@ -167,7 +167,7 @@ get_player_count(const char *pos, size_t remain) assert_return(pos && remain > 0, -1); - online = memmem(pos, remain, ONLINE_NEEDLE, strlen(ONLINE_NEEDLE)); + online = memmem(pos, remain, ONLINE_NEEDLE, STRLEN(ONLINE_NEEDLE)); if (!online) { error("could not find online count in JSON"); return -1; diff --git a/minecproxy/server.c b/minecproxy/server.c index c6e6480..c1480f3 100644 --- a/minecproxy/server.c +++ b/minecproxy/server.c @@ -684,7 +684,7 @@ server_set_systemd_service(struct server *server, const char *service) suffix = strrchr(service, '.'); if (!suffix || !streq(suffix, ".service")) { - tmp = zmalloc(strlen(service) + strlen(".service") + 1); + tmp = zmalloc(strlen(service) + STRLEN(".service") + 1); if (tmp) sprintf(tmp, "%s.service", service); } else diff --git a/minecproxy/systemd.c b/minecproxy/systemd.c index a44b0d8..e9ed885 100644 --- a/minecproxy/systemd.c +++ b/minecproxy/systemd.c @@ -38,12 +38,12 @@ systemd_object_path(const char *service) assert_return(service && !empty_str(service), NULL); - r = zmalloc(strlen(SYSTEMD_DBUS_PATH_PREFIX) + strlen(service) * 3 + 1); + r = zmalloc(STRLEN(SYSTEMD_DBUS_PATH_PREFIX) + strlen(service) * 3 + 1); if (!r) return NULL; - memcpy(r, SYSTEMD_DBUS_PATH_PREFIX, strlen(SYSTEMD_DBUS_PATH_PREFIX)); - d = r + strlen(SYSTEMD_DBUS_PATH_PREFIX); + memcpy(r, SYSTEMD_DBUS_PATH_PREFIX, STRLEN(SYSTEMD_DBUS_PATH_PREFIX)); + d = r + STRLEN(SYSTEMD_DBUS_PATH_PREFIX); for (s = service; *s; s++) { if ((*s >= 'a' && *s <= 'z') || diff --git a/minecproxy/uring.c b/minecproxy/uring.c index 79b90b8..abea592 100644 --- a/minecproxy/uring.c +++ b/minecproxy/uring.c @@ -68,7 +68,7 @@ uring_task_refdump(struct uring_task *task) char *dst; if (tmp->parent) - prefix = strlen("->") + strlen(tmp->name); + prefix = STRLEN("->") + strlen(tmp->name); else prefix = strlen(tmp->name); |