summaryrefslogtreecommitdiff
path: root/src/libudev/strv.c
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2014-08-05 17:03:25 -0400
committerAnthony G. Basile <blueness@gentoo.org>2014-08-05 17:03:25 -0400
commit4b8733ffe9c0fe8e5a527186d323dab93e43fb37 (patch)
tree54e6e64995f65e619fdbd9a40b2b1e83244507b7 /src/libudev/strv.c
parente35ef44ebe788aaffd1f6910750492bacaba7b6f (diff)
src/{libudev,udev}: minor renamings from upstream
Diffstat (limited to 'src/libudev/strv.c')
-rw-r--r--src/libudev/strv.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libudev/strv.c b/src/libudev/strv.c
index cbfe2388d6..da8ea8a0a6 100644
--- a/src/libudev/strv.c
+++ b/src/libudev/strv.c
@@ -161,9 +161,18 @@ int strv_push(char ***l, char *value) {
return 0;
}
+int strv_consume(char ***l, char *value) {
+ int r;
+
+ r = strv_push(l, value);
+ if (r < 0)
+ free(value);
+
+ return r;
+}
+
int strv_extend(char ***l, const char *value) {
char *v;
- int r;
if (!value)
return 0;
@@ -172,11 +181,7 @@ int strv_extend(char ***l, const char *value) {
if (!v)
return -ENOMEM;
- r = strv_push(l, v);
- if (r < 0)
- free(v);
-
- return r;
+ return strv_consume(l, v);
}
char **strv_uniq(char **l) {