summaryrefslogtreecommitdiff
path: root/src/shared/fileio.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-10 09:48:59 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-12 10:20:55 -0400
commitca2d37841476e6272c9957c3f5a0cbe869a531ca (patch)
treeab1dea346bd6342248858be26e9638437141a0d1 /src/shared/fileio.c
parent7cc832b91e8f5883b505c42f9f403e03dfc83c89 (diff)
Unify GREEDY_REALLOC and GREEDY_REALLOC_T
greedy_realloc() and greedy_realloc0() now store the allocated size as the count, not bytes. Replace GREEDY_REALLOC uses with GREEDY_REALLOC_T everywhere, and then rename GREEDY_REALLOC_T to GREEDY_REALLOC. It is just too error-prone to have two slightly different macros which do the same thing.
Diffstat (limited to 'src/shared/fileio.c')
-rw-r--r--src/shared/fileio.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index f10126954b..c7b2cd85b9 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -294,7 +294,7 @@ static int parse_env_file_internal(
state = KEY;
last_key_whitespace = (size_t) -1;
- if (!greedy_realloc((void**) &key, &key_alloc, n_key+2)) {
+ if (!GREEDY_REALLOC(key, key_alloc, n_key+2)) {
r = -ENOMEM;
goto fail;
}
@@ -317,7 +317,7 @@ static int parse_env_file_internal(
else if (last_key_whitespace == (size_t) -1)
last_key_whitespace = n_key;
- if (!greedy_realloc((void**) &key, &key_alloc, n_key+2)) {
+ if (!GREEDY_REALLOC(key, key_alloc, n_key+2)) {
r = -ENOMEM;
goto fail;
}
@@ -357,7 +357,7 @@ static int parse_env_file_internal(
else if (!strchr(WHITESPACE, c)) {
state = VALUE;
- if (!greedy_realloc((void**) &value, &value_alloc, n_value+2)) {
+ if (!GREEDY_REALLOC(value, value_alloc, n_value+2)) {
r = -ENOMEM;
goto fail;
}
@@ -402,7 +402,7 @@ static int parse_env_file_internal(
else if (last_value_whitespace == (size_t) -1)
last_value_whitespace = n_value;
- if (!greedy_realloc((void**) &value, &value_alloc, n_value+2)) {
+ if (!GREEDY_REALLOC(value, value_alloc, n_value+2)) {
r = -ENOMEM;
goto fail;
}
@@ -417,7 +417,7 @@ static int parse_env_file_internal(
if (!strchr(newline, c)) {
/* Escaped newlines we eat up entirely */
- if (!greedy_realloc((void**) &value, &value_alloc, n_value+2)) {
+ if (!GREEDY_REALLOC(value, value_alloc, n_value+2)) {
r = -ENOMEM;
goto fail;
}
@@ -432,7 +432,7 @@ static int parse_env_file_internal(
else if (c == '\\')
state = SINGLE_QUOTE_VALUE_ESCAPE;
else {
- if (!greedy_realloc((void**) &value, &value_alloc, n_value+2)) {
+ if (!GREEDY_REALLOC(value, value_alloc, n_value+2)) {
r = -ENOMEM;
goto fail;
}
@@ -446,7 +446,7 @@ static int parse_env_file_internal(
state = SINGLE_QUOTE_VALUE;
if (!strchr(newline, c)) {
- if (!greedy_realloc((void**) &value, &value_alloc, n_value+2)) {
+ if (!GREEDY_REALLOC(value, value_alloc, n_value+2)) {
r = -ENOMEM;
goto fail;
}
@@ -461,7 +461,7 @@ static int parse_env_file_internal(
else if (c == '\\')
state = DOUBLE_QUOTE_VALUE_ESCAPE;
else {
- if (!greedy_realloc((void**) &value, &value_alloc, n_value+2)) {
+ if (!GREEDY_REALLOC(value, value_alloc, n_value+2)) {
r = -ENOMEM;
goto fail;
}
@@ -475,7 +475,7 @@ static int parse_env_file_internal(
state = DOUBLE_QUOTE_VALUE;
if (!strchr(newline, c)) {
- if (!greedy_realloc((void**) &value, &value_alloc, n_value+2)) {
+ if (!GREEDY_REALLOC(value, value_alloc, n_value+2)) {
r = -ENOMEM;
goto fail;
}