diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2023-03-18 21:02:10 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2023-03-21 18:12:28 +0100 |
commit | 54156a3d9a2a7f87591e5efd37a8fe6f708b933f (patch) | |
tree | 8df5ecafc1fd199adb05ea8f4573103c38c63848 /src/irmd/utils.c | |
parent | 9ce5f6b0b1ae281bfa82df31a92026d946366286 (diff) | |
download | ouroboros-54156a3d9a2a7f87591e5efd37a8fe6f708b933f.tar.gz ouroboros-54156a3d9a2a7f87591e5efd37a8fe6f708b933f.zip |
irmd: Move registry objects to their own sources
Rename internal data structures so it's clear that they are the IRMd
representation of these objects for management purposes.
Split functionality for these objects off and and move them to their
own source files.
Rename internal functions of the IRMd to reflect this, with some small
refactoring.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/irmd/utils.c')
-rw-r--r-- | src/irmd/utils.c | 17 |
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++)); |