From 41be2fa5bc7520b4d9ba2028aa151ddfac8e62ed Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 2 Aug 2018 22:02:50 +0200 Subject: [PATCH] get config type --- lib/ecoli_config.c | 5 +++++ lib/ecoli_config.h | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/ecoli_config.c b/lib/ecoli_config.c index f8a45d7..fd709f2 100644 --- a/lib/ecoli_config.c +++ b/lib/ecoli_config.c @@ -184,6 +184,11 @@ ec_config_schema_dump(FILE *out, const struct ec_config_schema *schema, __ec_config_schema_dump(out, schema, schema_len, 0); } +enum ec_config_type ec_config_get_type(const struct ec_config *config) +{ + return config->type; +} + struct ec_config * ec_config_bool(bool boolean) { diff --git a/lib/ecoli_config.h b/lib/ecoli_config.h index fa6b501..96e47b3 100644 --- a/lib/ecoli_config.h +++ b/lib/ecoli_config.h @@ -8,6 +8,7 @@ #include #include #include +#include #ifndef EC_COUNT_OF //XXX #define EC_COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / \ @@ -109,6 +110,16 @@ void ec_config_schema_dump(FILE *out, const struct ec_config_schema *schema, /* config */ +/** + * Get the type of the configuration. + * + * @param config + * The configuration. + * @return + * The configuration type. + */ +enum ec_config_type ec_config_get_type(const struct ec_config *config); + /** * Create a boolean configuration value. * -- 2.39.5