From da2aac4a6eb10af88e3938068e24c58aea1832b1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 12 Jun 2018 20:05:34 -0700 Subject: fixes #540 nni_ep_opttype serves no purpose fixes #538 setopt should have an explicit chkopt routine fixes #537 Internal TCP API needs better name separation fixes #524 Option types should be "typed" This is a rework of the option management code, to make it both clearer and to prepare for further work to break up endpoints. This reduces a certain amount of dead or redundant code, and actually saves cycles when setting options, as some loops were not terminated that should have been. --- src/core/pipe.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/core/pipe.c') diff --git a/src/core/pipe.c b/src/core/pipe.c index ccd0dbe7..93fbae99 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -359,18 +359,19 @@ nni_pipe_create(nni_ep *ep, void *tdata) } int -nni_pipe_getopt(nni_pipe *p, const char *name, void *val, size_t *szp, int typ) +nni_pipe_getopt( + nni_pipe *p, const char *name, void *val, size_t *szp, nni_opt_type t) { - nni_tran_pipe_option *po; + nni_tran_option *o; - for (po = p->p_tran_ops.p_options; po && po->po_name; po++) { - if (strcmp(po->po_name, name) != 0) { + for (o = p->p_tran_ops.p_options; o && o->o_name; o++) { + if (strcmp(o->o_name, name) != 0) { continue; } - return (po->po_getopt(p->p_tran_data, val, szp, typ)); + return (o->o_get(p->p_tran_data, val, szp, t)); } // Maybe the endpoint knows? - return (nni_ep_getopt(p->p_ep, name, val, szp, typ)); + return (nni_ep_getopt(p->p_ep, name, val, szp, t)); } void -- cgit v1.2.3-70-g09d2