summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorDennis Camera <skonfig@dtnr.ch>2022-08-21 10:07:29 +0200
committerDennis Camera <skonfig@dtnr.ch>2022-08-21 10:07:59 +0200
commit6ed18ee1677007b9870fad63b8ef11e7d9afe0d9 (patch)
tree42222b1b895bc9f77383dbbd2cee924834d15927 /src/config.c
parentdb2282253024c86d16622ca7650768cd476c023d (diff)
downloadskonfig-c-6ed18ee1677007b9870fad63b8ef11e7d9afe0d9.tar.gz
skonfig-c-6ed18ee1677007b9870fad63b8ef11e7d9afe0d9.zip
Work around void * arithmetic errors
...but the data structure should probably be reworked instead of relying on the optional uintptr_t type :-/
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index bc7c28b..997a53c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -7,6 +7,7 @@
#include <string.h>
#include <strings.h>
#include <unistd.h>
+#include <stdint.h>
/******************************************************************************/
@@ -118,8 +119,7 @@ void sk_config_cpy(struct sk_config *restrict dest, const struct sk_config *rest
size_t last = 0;
while (src->global.conf_dir[last] != NULL) last++;
last--;
- char *end = src->global.conf_dir[last] + strlen(src->global.conf_dir[last]);
- size_t bufsz = (void *)end - (void *)src->global.conf_dir;
+ size_t bufsz = ((uintptr_t)src->global.conf_dir[last] - (uintptr_t)src->global.conf_dir) + strlen(src->global.conf_dir[last]) * sizeof(char);
void *dbuf = malloc(bufsz);
memcpy(dbuf, src->global.conf_dir, bufsz);