summaryrefslogtreecommitdiffstats
path: root/ini/ini_parse.c
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2012-12-23 11:59:48 -0500
committerOndrej Kos <okos@redhat.com>2013-01-24 08:34:35 +0100
commit360710d1a6c0c24d00a915a630884281b0b9e665 (patch)
tree428e2eee95344570c6ebf8ede39180e5031f1e50 /ini/ini_parse.c
parent9b368a8652b595528dcf85c9ecfeba0d93550ee1 (diff)
downloadding-libs-360710d1a6c0c24d00a915a630884281b0b9e665.tar.gz
ding-libs-360710d1a6c0c24d00a915a630884281b0b9e665.tar.xz
ding-libs-360710d1a6c0c24d00a915a630884281b0b9e665.zip
Use ENOMEM instead of errno
Reviewed all uses or errno. Cleaned places that needed cleaning. Did not remove <errno.h> yet where it is not needed.
Diffstat (limited to 'ini/ini_parse.c')
-rw-r--r--ini/ini_parse.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/ini/ini_parse.c b/ini/ini_parse.c
index 5d39375..9e81f2d 100644
--- a/ini/ini_parse.c
+++ b/ini/ini_parse.c
@@ -1012,12 +1012,10 @@ static int handle_kvp(struct parser_obj *po, uint32_t *action)
}
/* Dup the key name */
- errno = 0;
po->key = malloc(len + 1);
if (!(po->key)) {
- error = errno;
- TRACE_ERROR_NUMBER("Failed to dup key", error);
- return error;
+ TRACE_ERROR_NUMBER("Failed to dup key", ENOMEM);
+ return ENOMEM;
}
memcpy(po->key, po->last_read, len);
@@ -1040,12 +1038,10 @@ static int handle_kvp(struct parser_obj *po, uint32_t *action)
TRACE_INFO_NUMBER("LENGTH:", len);
/* Dup the part of the value */
- errno = 0;
dupval = malloc(len + 1);
if (!dupval) {
- error = errno;
- TRACE_ERROR_NUMBER("Failed to dup value", error);
- return error;
+ TRACE_ERROR_NUMBER("Failed to dup value", ENOMEM);
+ return ENOMEM;
}
memcpy(dupval, eq, len);
@@ -1152,12 +1148,10 @@ static int handle_section(struct parser_obj *po, uint32_t *action)
}
/* Dup the name */
- errno = 0;
dupval = malloc(len + 1);
if (!dupval) {
- error = errno;
- TRACE_ERROR_NUMBER("Failed to dup section name", error);
- return error;
+ TRACE_ERROR_NUMBER("Failed to dup section name", ENOMEM);
+ return ENOMEM;
}
memcpy(dupval, start, len);