diff options
author | Tim Segers <tsegers@pm.me> | 2023-01-03 19:05:07 +0100 |
---|---|---|
committer | Tim Segers <tsegers@pm.me> | 2023-01-07 15:24:51 +0100 |
commit | 5737a0996df3b9f11d541cc45c7e32ae3b9a7aac (patch) | |
tree | c10198be821b3b5f62f7a5685309688fe8ccc150 | |
parent | 9bcb365abd6ec10013c806666d21f016ff7105df (diff) | |
download | opendeco-5737a0996df3b9f11d541cc45c7e32ae3b9a7aac.tar.gz |
Make print_xxd_arr a function instead of a macro
-rw-r--r-- | src/opendeco-cli.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/opendeco-cli.c b/src/opendeco-cli.c index 481ef66..5f6b627 100644 --- a/src/opendeco-cli.c +++ b/src/opendeco-cli.c @@ -10,16 +10,6 @@ #include "toml/LICENSE.h" #include "minunit/LICENSE.h" -#define print_xxd_arr(name, arrname) \ - do { \ - char *tmp = strndup((const char *) arrname, arrname##_len); \ - wprintf(L"--------\n\n"); \ - wprintf(L"License for: %s\n\n", name); \ - wprintf(L"%s", tmp); \ - wprintf(L"\n"); \ - free(tmp); \ - } while (0) - static char args_doc[] = ""; static char doc[] = "Implementation of Buhlmann ZH-L16 with Gradient Factors:" "\vExamples:\n\n" @@ -51,11 +41,23 @@ static struct argp_option options[] = { {0, 0, 0, 0, 0, 0 } }; +static void print_xxd_arr(char *name, unsigned char *content, unsigned int len) +{ + char *tmp = strndup((const char *) content, len); + + wprintf(L"--------\n\n"); + wprintf(L"License for: %s\n\n", name); + wprintf(L"%s", tmp); + wprintf(L"\n"); + + free(tmp); +} + static void print_licenses() { wprintf(L"THIRD-PARTY LICENSES:\n\n"); - print_xxd_arr("cktan/tomlc99", toml_LICENSE); - print_xxd_arr("siu/minunit", minunit_LICENSE); + print_xxd_arr("cktan/tomlc99", toml_LICENSE, toml_LICENSE_len); + print_xxd_arr("siu/minunit", minunit_LICENSE, minunit_LICENSE_len); } static error_t parse_opt(int key, char *arg, struct argp_state *state) |