oconfig_item_t *ci) {
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) {
ERROR("`value' match: `%s' needs exactly one string argument.", ci->key);
- return (-1);
+ return -1;
}
if (strcasecmp("All", ci->values[0].value.string) == 0)
ERROR("`value' match: Passing `%s' to the `%s' option is invalid. "
"The argument must either be `All' or `Any'.",
ci->values[0].value.string, ci->key);
- return (-1);
+ return -1;
}
- return (0);
+ return 0;
} /* }}} int mv_config_add_satisfy */
static int mv_config_add_data_source(mv_match_t *m, /* {{{ */
/* Check number of arbuments. */
if (ci->values_num < 1) {
ERROR("`value' match: `%s' needs at least one argument.", ci->key);
- return (-1);
+ return -1;
}
/* Check type of arguments */
ci->key, i + 1,
(ci->values[i].type == OCONFIG_TYPE_BOOLEAN) ? "truth value"
: "number");
- return (-1);
+ return -1;
}
/* Allocate space for the char pointers */
temp = realloc(m->data_sources, new_data_sources_num * sizeof(char *));
if (temp == NULL) {
ERROR("`value' match: realloc failed.");
- return (-1);
+ return -1;
}
m->data_sources = temp;
m->data_sources_num++;
}
- return (0);
+ return 0;
} /* }}} int mv_config_add_data_source */
static int mv_config_add_gauge(gauge_t *ret_value, /* {{{ */
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_NUMBER)) {
ERROR("`value' match: `%s' needs exactly one numeric argument.", ci->key);
- return (-1);
+ return -1;
}
*ret_value = ci->values[0].value.number;
- return (0);
+ return 0;
} /* }}} int mv_config_add_gauge */
static int mv_config_add_boolean(int *ret_value, /* {{{ */
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN)) {
ERROR("`value' match: `%s' needs exactly one boolean argument.", ci->key);
- return (-1);
+ return -1;
}
if (ci->values[0].value.boolean)
else
*ret_value = 0;
- return (0);
+ return 0;
} /* }}} int mv_config_add_boolean */
static int mv_create(const oconfig_item_t *ci, void **user_data) /* {{{ */
m = calloc(1, sizeof(*m));
if (m == NULL) {
ERROR("mv_create: calloc failed.");
- return (-ENOMEM);
+ return -ENOMEM;
}
m->min = NAN;
if (status != 0) {
mv_free_match(m);
- return (status);
+ return status;
}
*user_data = m;
- return (0);
+ return 0;
} /* }}} int mv_create */
static int mv_destroy(void **user_data) /* {{{ */
{
if ((user_data != NULL) && (*user_data != NULL))
mv_free_match(*user_data);
- return (0);
+ return 0;
} /* }}} int mv_destroy */
static int mv_match(const data_set_t *ds, const value_list_t *vl, /* {{{ */
int status;
if ((user_data == NULL) || (*user_data == NULL))
- return (-1);
+ return -1;
m = *user_data;
if (values == NULL) {
ERROR("`value' match: Retrieving the current rate from the cache "
"failed.");
- return (-1);
+ return -1;
}
status = FC_MATCH_NO_MATCH;
} /* for (i = 0; i < ds->ds_num; i++) */
free(values);
- return (status);
+ return status;
} /* }}} int mv_match */
void module_register(void) {