On 1/2/18 2:37 AM, Leon Romanovsky wrote:
> +/*
> + * Check if string entry is filtered:
> + * * key doesn't exist -> user didn't request -> not filtered
> + */
> +bool rd_check_is_string_filtered(struct rd *rd, const char *key, char *val)
> +{
> + bool key_is_filtered = false;
> + struct filter_entry *fe;
> + char *p = NULL;
> + char *str;
> +
> + list_for_each_entry(fe, &rd->filter_list, list) {
> + if (!strcmpx(fe->key, key)) {
> + /* We found the key */
> + p = strdup(fe->value);
if (p == NULL) ...
> +
> + /*
> + * Need to check if value in range
> + * It can come in the following formats
> + * and their permutations:
> + * str
> + * str1,str2
> + */
> + str = strtok(p, ",");
> + while (str) {
> + if (!strcmpx(str, val)) {
> + key_is_filtered = true;
> + goto out;
> + }
> + str = strtok(NULL, ",");
> + }
> + goto out;
> + }
> + }
> +
> +out:
> + free(p);
> + return key_is_filtered;
> +}
> +