commit 15e9b6285b887c18798d576a221d667380e1de2c
parent b5e8d2757612ee6e023ddcd0eabc1a2bdb0432b8
Author: hhvn <dev@hhvn.uk>
Date: Sat, 15 Jan 2022 21:25:07 +0000
s/main.c s/config.c: reallocarray is nonstandard *pffft*
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/config.c b/src/config.c
@@ -1356,9 +1356,9 @@ config_read(char *filename) {
/* Expand bt and add real path */
if (!bt)
- bt = calloc(sizeof(char *), btoffset + 1);
+ bt = emalloc((sizeof(char *)) * (btoffset + 1));
else
- bt = reallocarray(bt, sizeof(char *), btoffset + 1);
+ bt = realloc(bt, (sizeof(char *)) * (btoffset + 1));
assert(bt != NULL);
*(bt + btoffset) = path;
@@ -1386,7 +1386,7 @@ shrink:
free(bt);
bt = NULL;
} else {
- bt = reallocarray(bt, sizeof(char *), btoffset);
+ bt = realloc(bt, (sizeof(char *)) * btoffset);
assert(bt != NULL);
}
}
diff --git a/src/main.c b/src/main.c
@@ -68,9 +68,9 @@ talloc(size_t size) {
if (size) {
mem = emalloc(size);
if (!mems)
- mema = calloc(sizeof(char *), mems + 1);
+ mema = malloc((sizeof(char *)) * (mems + 1));
else
- mema = reallocarray(mema, sizeof(char *), mems + 1);
+ mema = realloc(mema, (sizeof(char *)) * (mems + 1));
assert(mema != NULL);
*(mema + mems) = mem;