summaryrefslogtreecommitdiff
path: root/src/irmd/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/irmd/utils.c')
-rw-r--r--src/irmd/utils.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/irmd/utils.c b/src/irmd/utils.c
index 0e2a26e1..bae2b8b1 100644
--- a/src/irmd/utils.c
+++ b/src/irmd/utils.c
@@ -25,12 +25,27 @@
#include <stdlib.h>
#include <string.h>
+size_t argvlen(char ** argv)
+{
+ size_t argc = 0;
+
+ if (argv == NULL)
+ return 0;
+
+ while (*argv++ != NULL)
+ argc++;
+
+ return argc;
+}
+
void argvfree(char ** argv)
{
- char ** argv_dup = argv;
+ char ** argv_dup;
+
if (argv == NULL)
return;
+ argv_dup = argv;
while (*argv_dup != NULL)
free(*(argv_dup++));