X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgraph_instance.c;h=317c381f77f7c48aad0dd664d4279161290ed032;hb=b8b8d15d228be65ae62db08e4163d34e958e7766;hp=671430ab6ab711c0408ab35b4825aff58f0d6f97;hpb=7411750e5355656ba767517b201674aebb8312fa;p=collection4.git diff --git a/src/graph_instance.c b/src/graph_instance.c index 671430a..317c381 100644 --- a/src/graph_instance.c +++ b/src/graph_instance.c @@ -26,7 +26,7 @@ struct graph_instance_s /* {{{ */ struct def_callback_data_s { graph_instance_t *inst; - str_array_t *args; + rrd_args_t *args; }; typedef struct def_callback_data_s def_callback_data_t; @@ -124,7 +124,7 @@ static int gl_instance_get_rrdargs_cb (graph_def_t *def, void *user_data) /* {{{ { def_callback_data_t *data = user_data; graph_instance_t *inst = data->inst; - str_array_t *args = data->args; + rrd_args_t *args = data->args; size_t i; @@ -286,9 +286,32 @@ graph_instance_t *inst_get_selected (graph_config_t *cfg) /* {{{ */ return (inst); } /* }}} graph_instance_t *inst_get_selected */ +int inst_get_all_selected (graph_config_t *cfg, /* {{{ */ + graph_inst_callback_t callback, void *user_data) +{ + graph_ident_t *ident; + int status; + + if ((cfg == NULL) || (callback == NULL)) + return (EINVAL); + + ident = inst_get_selector_from_params (); + if (ident == NULL) + { + fprintf (stderr, "inst_get_all_selected: " + "inst_get_selector_from_params failed\n"); + return (EINVAL); + } + + status = graph_inst_find_all_matching (cfg, ident, callback, user_data); + + ident_destroy (ident); + return (status); +} /* }}} int inst_get_all_selected */ + int inst_get_rrdargs (graph_config_t *cfg, /* {{{ */ graph_instance_t *inst, - str_array_t *args) + rrd_args_t *args) { def_callback_data_t data = { inst, args }; graph_def_t *defs; @@ -396,13 +419,22 @@ int inst_compare_ident (graph_instance_t *inst, /* {{{ */ return (ident_compare (inst->select, ident)); } /* }}} int inst_compare_ident */ -_Bool inst_matches_ident (graph_instance_t *inst, /* {{{ */ +_Bool inst_ident_matches (graph_instance_t *inst, /* {{{ */ const graph_ident_t *ident) { if ((inst == NULL) || (ident == NULL)) return (0); return (ident_matches (inst->select, ident)); +} /* }}} _Bool inst_ident_matches */ + +_Bool inst_matches_ident (graph_instance_t *inst, /* {{{ */ + const graph_ident_t *ident) +{ + if ((inst == NULL) || (ident == NULL)) + return (0); + + return (ident_matches (ident, inst->select)); } /* }}} _Bool inst_matches_ident */ _Bool inst_matches_string (graph_config_t *cfg, /* {{{ */