diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-01-04 17:57:28 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-01-04 18:00:09 -0800 |
| commit | f77e5a5ec7f8b1373eeda0ea56f47137daf40330 (patch) | |
| tree | 9f2f10860a70765924dba9231bf3e2e4650f8b82 /src/tools/perf | |
| parent | a40b421d39a64c285a4ac23304538690aaa90739 (diff) | |
| download | nng-f77e5a5ec7f8b1373eeda0ea56f47137daf40330.tar.gz nng-f77e5a5ec7f8b1373eeda0ea56f47137daf40330.tar.bz2 nng-f77e5a5ec7f8b1373eeda0ea56f47137daf40330.zip | |
args: Convert nng_opts_parse into a header only library using `nng_args_parse`.
The API is identical, except that some names have changed, and this is now a
header library in `nng/args.h` - so the core library does not need to carry this
code in binaries. Being a header library also means it is not necessary to
link against NNG, and it does not include any parts of NNG; it only depends on
a standard C99 or C11 environment.
Diffstat (limited to 'src/tools/perf')
| -rw-r--r-- | src/tools/perf/perf.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tools/perf/perf.c b/src/tools/perf/perf.c index 5ce99c04..e83c89ff 100644 --- a/src/tools/perf/perf.c +++ b/src/tools/perf/perf.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -15,8 +15,8 @@ #include <stdlib.h> #include <string.h> +#include <nng/args.h> #include <nng/nng.h> -#include <nng/supplemental/util/options.h> static void die(const char *, ...); static int @@ -80,15 +80,15 @@ enum options { }; // These are not universally supported by the variants yet. -static nng_optspec opts[] = { - { .o_name = "pair1", .o_val = OPT_PAIR1 }, - { .o_name = "pair0", .o_val = OPT_PAIR0 }, - { .o_name = "reqrep0", .o_val = OPT_REQREP0 }, - { .o_name = "bus0", .o_val = OPT_BUS0 }, - { .o_name = "pubsub0", .o_val = OPT_PUBSUB0 }, - { .o_name = "pipeline0", .o_val = OPT_PIPELINE0 }, - { .o_name = "url", .o_val = OPT_URL, .o_arg = true }, - { .o_name = NULL, .o_val = 0 }, +static nng_arg_spec opts[] = { + { .a_name = "pair1", .a_val = OPT_PAIR1 }, + { .a_name = "pair0", .a_val = OPT_PAIR0 }, + { .a_name = "reqrep0", .a_val = OPT_REQREP0 }, + { .a_name = "bus0", .a_val = OPT_BUS0 }, + { .a_name = "pubsub0", .a_val = OPT_PUBSUB0 }, + { .a_name = "pipeline0", .a_val = OPT_PIPELINE0 }, + { .a_name = "url", .a_val = OPT_URL, .a_arg = true }, + { .a_name = NULL, .a_val = 0 }, }; static void latency_client(const char *, size_t, int); @@ -319,7 +319,7 @@ do_inproc_lat(int argc, char **argv) addr = "inproc://latency_test"; optidx = 0; - while ((rv = nng_opts_parse(argc, argv, opts, &val, &arg, &optidx)) == + while ((rv = nng_args_parse(argc, argv, opts, &val, &arg, &optidx)) == 0) { switch (val) { case OPT_REQREP0: @@ -381,7 +381,7 @@ do_inproc_thr(int argc, char **argv) char *addr = "inproc://throughput-test"; optidx = 0; - while ((rv = nng_opts_parse(argc, argv, opts, &val, &arg, &optidx)) == + while ((rv = nng_args_parse(argc, argv, opts, &val, &arg, &optidx)) == 0) { switch (val) { #if 0 |
