From 2266ec4a9bd61379f677d164231880d18e534d31 Mon Sep 17 00:00:00 2001 From: Richard Aas Date: Mon, 11 Jun 2012 05:19:08 +0000 Subject: [PATCH] conf: const struct conf on accessor functions --- include/re_conf.h | 11 ++++++----- src/conf/conf.c | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/re_conf.h b/include/re_conf.h index a49fe3d..8c5d008 100644 --- a/include/re_conf.h +++ b/include/re_conf.h @@ -11,9 +11,10 @@ typedef int (conf_h)(const struct pl *val, void *arg); int conf_alloc(struct conf **confp, const char *filename); int conf_alloc_buf(struct conf **confp, const uint8_t *buf, size_t sz); -int conf_get(struct conf *conf, const char *name, struct pl *pl); -int conf_get_str(struct conf *conf, const char *name, char *str, +int conf_get(const struct conf *conf, const char *name, struct pl *pl); +int conf_get_str(const struct conf *conf, const char *name, char *str, size_t size); -int conf_get_u32(struct conf *conf, const char *name, uint32_t *num); -int conf_get_bool(struct conf *conf, const char *name, bool *val); -int conf_apply(struct conf *conf, const char *name, conf_h *ch, void *arg); +int conf_get_u32(const struct conf *conf, const char *name, uint32_t *num); +int conf_get_bool(const struct conf *conf, const char *name, bool *val); +int conf_apply(const struct conf *conf, const char *name, + conf_h *ch, void *arg); diff --git a/src/conf/conf.c b/src/conf/conf.c index 7f1ef8f..6c800a8 100644 --- a/src/conf/conf.c +++ b/src/conf/conf.c @@ -148,7 +148,7 @@ int conf_alloc_buf(struct conf **confp, const uint8_t *buf, size_t sz) * * @return 0 if success, otherwise errorcode */ -int conf_get(struct conf *conf, const char *name, struct pl *pl) +int conf_get(const struct conf *conf, const char *name, struct pl *pl) { char expr[512]; struct pl spl; @@ -176,7 +176,7 @@ int conf_get(struct conf *conf, const char *name, struct pl *pl) * * @return 0 if success, otherwise errorcode */ -int conf_get_str(struct conf *conf, const char *name, char *str, +int conf_get_str(const struct conf *conf, const char *name, char *str, size_t size) { struct pl pl; @@ -202,7 +202,7 @@ int conf_get_str(struct conf *conf, const char *name, char *str, * * @return 0 if success, otherwise errorcode */ -int conf_get_u32(struct conf *conf, const char *name, uint32_t *num) +int conf_get_u32(const struct conf *conf, const char *name, uint32_t *num) { struct pl pl; int err; @@ -229,7 +229,7 @@ int conf_get_u32(struct conf *conf, const char *name, uint32_t *num) * * @return 0 if success, otherwise errorcode */ -int conf_get_bool(struct conf *conf, const char *name, bool *val) +int conf_get_bool(const struct conf *conf, const char *name, bool *val) { struct pl pl; int err; @@ -264,7 +264,8 @@ int conf_get_bool(struct conf *conf, const char *name, bool *val) * * @return 0 if success, otherwise errorcode */ -int conf_apply(struct conf *conf, const char *name, conf_h *ch, void *arg) +int conf_apply(const struct conf *conf, const char *name, + conf_h *ch, void *arg) { char expr[512]; struct pl pl, val;