diff options
Diffstat (limited to 'src/core/options.c')
| -rw-r--r-- | src/core/options.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/options.c b/src/core/options.c index 0b15d6e2..82735369 100644 --- a/src/core/options.c +++ b/src/core/options.c @@ -398,4 +398,20 @@ nni_setopt(const nni_option *opts, const char *nm, void *arg, const void *buf, opts++; } return (NNG_ENOTSUP); +} + +int +nni_chkopt(const nni_chkoption *opts, const char *nm, const void *buf, + size_t sz, nni_type t) +{ + while (opts->o_name != NULL) { + if (strcmp(opts->o_name, nm) == 0) { + if (opts->o_check == NULL) { + return (NNG_EREADONLY); + } + return (opts->o_check(buf, sz, t)); + } + opts++; + } + return (NNG_ENOTSUP); }
\ No newline at end of file |
