From 038508b2212449e82ff8ace9eae8742d99ed0186 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Sat, 11 Aug 2018 14:46:29 +0200 Subject: [PATCH] more config accessor --- lib/ecoli_config.c | 12 ++++++++++++ lib/ecoli_config.h | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/lib/ecoli_config.c b/lib/ecoli_config.c index 63b5725..5a9a5fb 100644 --- a/lib/ecoli_config.c +++ b/lib/ecoli_config.c @@ -375,6 +375,18 @@ ec_config_schema_lookup(const struct ec_config_schema *schema, return NULL; } +enum ec_config_type +ec_config_schema_type(const struct ec_config_schema *schema_elt) +{ + return schema_elt->type; +} + +const struct ec_config_schema * +ec_config_schema_sub(const struct ec_config_schema *schema_elt) +{ + return schema_elt->subschema; +} + void ec_config_free(struct ec_config *value) { diff --git a/lib/ecoli_config.h b/lib/ecoli_config.h index 706af79..9d7c628 100644 --- a/lib/ecoli_config.h +++ b/lib/ecoli_config.h @@ -113,6 +113,28 @@ const struct ec_config_schema * ec_config_schema_lookup(const struct ec_config_schema *schema, const char *key); +/** + * Get the type of a schema entry. + * + * @param schema_elt + * Pointer to an element of the schema array. + * @return + * The type of the schema entry. + */ +enum ec_config_type +ec_config_schema_type(const struct ec_config_schema *schema_elt); + +/** + * Get the subschema of a schema entry. + * + * @param schema_elt + * Pointer to an element of the schema array. + * @return + * The subschema if any, or NULL. + */ +const struct ec_config_schema * +ec_config_schema_sub(const struct ec_config_schema *schema_elt); + /** * Check if a key name is reserved in a config dict. * -- 2.39.5