summaryrefslogtreecommitdiff
path: root/systemd/strv.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-07-05 14:39:14 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-07-05 15:10:30 -0400
commit31baccc855b48adde5173a31037bb1b82c42f7aa (patch)
treef932694ba82c76714400b09d08e7ebea435c1c51 /systemd/strv.c
parent022c9b5be4a1edf77bf73566a89ce41397f72147 (diff)
downloadpython-systemd-31baccc855b48adde5173a31037bb1b82c42f7aa.tar.gz
build-sys: update setup.py to build everything
Diffstat (limited to 'systemd/strv.c')
-rw-r--r--systemd/strv.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/systemd/strv.c b/systemd/strv.c
new file mode 100644
index 0000000..373346d
--- /dev/null
+++ b/systemd/strv.c
@@ -0,0 +1,40 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <stdlib.h>
+
+void strv_clear(char **l) {
+ char **k;
+
+ if (!l)
+ return;
+
+ for (k = l; *k; k++)
+ free(*k);
+
+ *l = NULL;
+}
+
+char **strv_free(char **l) {
+ strv_clear(l);
+ free(l);
+ return NULL;
+}