conf: const struct conf on accessor functions
This commit is contained in:
parent
a42708517b
commit
2266ec4a9b
2 changed files with 12 additions and 10 deletions
|
@ -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(struct conf **confp, const char *filename);
|
||||||
int conf_alloc_buf(struct conf **confp, const uint8_t *buf, size_t sz);
|
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(const struct conf *conf, const char *name, struct pl *pl);
|
||||||
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);
|
size_t size);
|
||||||
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);
|
||||||
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);
|
||||||
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);
|
||||||
|
|
|
@ -148,7 +148,7 @@ int conf_alloc_buf(struct conf **confp, const uint8_t *buf, size_t sz)
|
||||||
*
|
*
|
||||||
* @return 0 if success, otherwise errorcode
|
* @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];
|
char expr[512];
|
||||||
struct pl spl;
|
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
|
* @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)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct pl pl;
|
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
|
* @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;
|
struct pl pl;
|
||||||
int err;
|
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
|
* @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;
|
struct pl pl;
|
||||||
int err;
|
int err;
|
||||||
|
@ -264,7 +264,8 @@ int conf_get_bool(struct conf *conf, const char *name, bool *val)
|
||||||
*
|
*
|
||||||
* @return 0 if success, otherwise errorcode
|
* @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];
|
char expr[512];
|
||||||
struct pl pl, val;
|
struct pl pl, val;
|
||||||
|
|
Loading…
Add table
Reference in a new issue