}
MEM(*out = cf_pair_alloc(cs, rule->name1, value, T_OP_EQ, T_BARE_WORD, quote));
- cf_pair_mark_parsed(*out); /* Don't re-parse this */
+ cf_item_mark_parsed(*out); /* Don't re-parse this */
return 0;
}
cp_p;
cp_p = cf_pair_find_next(cs, cp_p, rule->name1), i++) {
if (kafka_config_parse_single(&array[i], cp_p, rule) < 0) return -1;
- cf_pair_mark_parsed(cp_p);
+ cf_item_mark_parsed(cp_p);
}
slen = talloc_array_concat(agg, array, kctx->string_sep);
*/
cf_pair_debug_log(cs, cp, rule);
- if (cf_pair_is_parsed(cp)) continue;
+ if (cp->item.parsed) continue;
ret = func(value_ctx, entry, base, cf_pair_to_item(cp), rule);
if (ret < 0) {
talloc_free(array);
return -1;
}
- cf_pair_mark_parsed(cp);
+ cp->item.parsed = true;
}
if (array) *(void **)out = array;
/*
cf_pair_debug_log(cs, cp, rule);
- if (cf_pair_is_parsed(cp)) return 0;
+ if (cp->item.parsed) return 0;
ret = func(ctx, out, base, cf_pair_to_item(cp), rule);
if (ret < 0) return -1;
- cf_pair_mark_parsed(cp);
+ cp->item.parsed = true;
}
return was_dflt ? 1 : 0;
CONF_ITEM_TYPE type; //!< Whether the config item is a config_pair, conf_section or cf_data.
+ bool parsed; //!< Was this item used during parsing?
+ bool referenced; //!< Was this item referenced in the config?
int lineno; //!< The line number the config item began on.
char const *filename; //!< The file the config item was parsed from.
};
fr_token_t rhs_quote; //!< Value Quoting style T_(DOUBLE|SINGLE|BACK)_QUOTE_STRING or T_BARE_WORD.
bool pass2; //!< do expansion in pass2.
- bool parsed; //!< Was this item used during parsing?
bool printed; //!< Was this item printed already in debug mode?
- bool referenced; //!< Was this item referenced in the config?
};
typedef enum {
}
-/** Mark a pair as parsed
+/** Mark an item as parsed
*
- * @param[in] cp to mark as parsed.
+ * @param[in] ci to mark as parsed.
*/
-void cf_pair_mark_parsed(CONF_PAIR *cp)
+void _cf_item_mark_parsed(CONF_ITEM *ci)
{
- cp->item.parsed = true;
+ ci->parsed = true;
}
-/** Return whether a pair has already been parsed
+/** Return whether an item has already been parsed
*
- * @param[in] cp to check.
+ * @param[in] ci to check.
* @return
- * - true if pair has been parsed.
+ * - true if item has been parsed.
* - false if the pair hasn't been parsed.
*/
-bool cf_pair_is_parsed(CONF_PAIR *cp)
+bool _cf_item_is_parsed(CONF_ITEM *ci)
{
- return cp->item.parsed;
+ return ci->parsed;
}
/** Return the first child that's a #CONF_PAIR
void cf_item_free_children(CONF_ITEM *ci);
+#define cf_item_mark_parsed(_cf) _cf_item_mark_parsed(CF_TO_ITEM(_cf))
+void _cf_item_mark_parsed(CONF_ITEM *ci);
+
+#define cf_item_is_parsed(_cf) _cf_item_is_parsed(CF_TO_ITEM(_cf))
+bool _cf_item_is_parsed(CONF_ITEM *ci);
+
/*
* Section manipulation and searching
*/
int cf_pair_replace(CONF_SECTION *cs, CONF_PAIR *cp, char const *value);
-void cf_pair_mark_parsed(CONF_PAIR *cp);
-
-bool cf_pair_is_parsed(CONF_PAIR *cp);
-
CONF_PAIR *cf_pair_first(CONF_SECTION const *cs);
CONF_PAIR *cf_pair_next(CONF_SECTION const *cs, CONF_PAIR const *curr);
entry->rcode = rcode; /* Override previous sql rcode */
}
- cf_pair_mark_parsed(cp); /* Make sure it doesn't emit a warning later */
+ cf_item_mark_parsed(cp); /* Make sure it doesn't emit a warning later */
}
return 0;