Added const char * in multiple places

This commit is contained in:
Olof hagsand 2020-07-02 19:25:48 +02:00
parent 0a985e6618
commit 593ed2ef3b
30 changed files with 138 additions and 136 deletions

View file

@ -63,8 +63,8 @@ int restconf_terminate(clicon_handle h);
int restconf_insert_attributes(cxobj *xdata, cvec *qvec); int restconf_insert_attributes(cxobj *xdata, cvec *qvec);
int restconf_main_extension_cb(clicon_handle h, yang_stmt *yext, yang_stmt *ys); int restconf_main_extension_cb(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
/* also in restconf_handle.h */ /* also in restconf_handle.h */
char *restconf_param_get(clicon_handle h, char *param); char *restconf_param_get(clicon_handle h, const char *param);
int restconf_param_set(clicon_handle h, char *param, char *val); int restconf_param_set(clicon_handle h, const char *param, char *val);
#endif /* _CLIXON_RESTCONF_H_ */ #endif /* _CLIXON_RESTCONF_H_ */

View file

@ -42,9 +42,9 @@
* Prototypes * Prototypes
*/ */
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
int restconf_reply_header(void *req, char *name, char *vfmt, ...) __attribute__ ((format (printf, 3, 4))); int restconf_reply_header(void *req, char *name, const char *vfmt, ...) __attribute__ ((format (printf, 3, 4)));
#else #else
int restconf_reply_header(FCGX_Request *req, char *name, char *vfmt, ...); int restconf_reply_header(FCGX_Request *req, char *name, const char *vfmt, ...);
#endif #endif
int restconf_reply_send(void *req, int code, cbuf *cb); int restconf_reply_send(void *req, int code, cbuf *cb);

View file

@ -90,7 +90,7 @@ restconf_reply_body_start(void *req0)
int int
restconf_reply_header(void *req0, restconf_reply_header(void *req0,
char *name, char *name,
char *vfmt, const char *vfmt,
...) ...)
{ {
FCGX_Request *req = (FCGX_Request *)req0; FCGX_Request *req = (FCGX_Request *)req0;

View file

@ -119,7 +119,7 @@ restconf_handle_exit(clicon_handle h)
*/ */
char * char *
restconf_param_get(clicon_handle h, restconf_param_get(clicon_handle h,
char *param) const char *param)
{ {
struct restconf_handle *rh = handle(h); struct restconf_handle *rh = handle(h);
@ -138,7 +138,7 @@ restconf_param_get(clicon_handle h,
*/ */
int int
restconf_param_set(clicon_handle h, restconf_param_set(clicon_handle h,
char *param, const char *param,
char *val) char *val)
{ {
struct restconf_handle *rh = handle(h); struct restconf_handle *rh = handle(h);

View file

@ -44,8 +44,8 @@
*/ */
clicon_handle restconf_handle_init(void); clicon_handle restconf_handle_init(void);
int restconf_handle_exit(clicon_handle h); int restconf_handle_exit(clicon_handle h);
char *restconf_param_get(clicon_handle h, char *param); char *restconf_param_get(clicon_handle h, const char *param);
int restconf_param_set(clicon_handle h, char *param, char *val); int restconf_param_set(clicon_handle h, const char *param, char *val);
int restconf_param_del_all(clicon_handle h); int restconf_param_del_all(clicon_handle h);
#endif /* _RESTCONF_HANDLE_H_ */ #endif /* _RESTCONF_HANDLE_H_ */

View file

@ -538,7 +538,7 @@ static const map_str2str namespace_map[] = {
*/ */
int int
example_upgrade(clicon_handle h, example_upgrade(clicon_handle h,
char *db, const char *db,
cxobj *xt, cxobj *xt,
modstate_diff_t *msd) modstate_diff_t *msd)
{ {

View file

@ -55,9 +55,9 @@ typedef struct {
/* /*
* Prototypes * Prototypes
*/ */
int clicon_data_get(clicon_handle h, char *id, char **val); int clicon_data_get(clicon_handle h, const char *name, char **val);
int clicon_data_set(clicon_handle h, char *id, char *val); int clicon_data_set(clicon_handle h, const char *name, char *val);
int clicon_data_del(clicon_handle h, char *name); int clicon_data_del(clicon_handle h, const char *name);
yang_stmt * clicon_dbspec_yang(clicon_handle h); yang_stmt * clicon_dbspec_yang(clicon_handle h);
int clicon_dbspec_yang_set(clicon_handle h, yang_stmt *ys); int clicon_dbspec_yang_set(clicon_handle h, yang_stmt *ys);

View file

@ -52,7 +52,7 @@ int xmldb_disconnect(clicon_handle h);
/* in clixon_datastore_read.[ch] */ /* in clixon_datastore_read.[ch] */
int xmldb_get(clicon_handle h, const char *db, cvec *nsc, char *xpath, cxobj **xtop); int xmldb_get(clicon_handle h, const char *db, cvec *nsc, char *xpath, cxobj **xtop);
int xmldb_get0(clicon_handle h, const char *db, int xmldb_get0(clicon_handle h, const char *db,
cvec *nsc, char *xpath, cvec *nsc, const char *xpath,
int copy, cxobj **xtop, modstate_diff_t *msd); int copy, cxobj **xtop, modstate_diff_t *msd);
int xmldb_get0_clear(clicon_handle h, cxobj *x); int xmldb_get0_clear(clicon_handle h, cxobj *x);
int xmldb_get0_free(clicon_handle h, cxobj **xp); int xmldb_get0_free(clicon_handle h, cxobj **xp);

View file

@ -94,9 +94,9 @@ extern char clicon_err_reason[ERR_STRLEN];
*/ */
int clicon_err_reset(void); int clicon_err_reset(void);
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
int clicon_err_fn(const char *fn, const int line, int category, int err, char *format, ...) __attribute__ ((format (printf, 5, 6))); int clicon_err_fn(const char *fn, const int line, int category, int err, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
#else #else
int clicon_err_fn(const char *fn, const int line, int category, int err, char *format, ...); int clicon_err_fn(const char *fn, const int line, int category, int err, const char *format, ...);
#endif #endif
char *clicon_strerror(int err); char *clicon_strerror(int err);
void *clicon_err_save(void); void *clicon_err_save(void);

View file

@ -55,11 +55,11 @@ int clicon_log_opt(char c);
int clicon_log_file(char *filename); int clicon_log_file(char *filename);
int clicon_get_logflags(void); int clicon_get_logflags(void);
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
int clicon_log(int level, char *format, ...) __attribute__ ((format (printf, 2, 3))); int clicon_log(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
int clicon_debug(int dbglevel, char *format, ...) __attribute__ ((format (printf, 2, 3))); int clicon_debug(int dbglevel, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
#else #else
int clicon_log(int level, char *format, ...); int clicon_log(int level, const char *format, ...);
int clicon_debug(int dbglevel, char *format, ...); int clicon_debug(int dbglevel, const char *format, ...);
#endif #endif
int clicon_debug_init(int dbglevel, FILE *f); int clicon_debug_init(int dbglevel, FILE *f);
int clicon_debug_get(void); int clicon_debug_get(void);

View file

@ -125,7 +125,7 @@ enum regexp_mode{
int clicon_option_dump(clicon_handle h, int dblevel); int clicon_option_dump(clicon_handle h, int dblevel);
/* Add a clicon options overriding file setting */ /* Add a clicon options overriding file setting */
int clicon_option_add(clicon_handle h, char *name, char *value); int clicon_option_add(clicon_handle h, const char *name, char *value);
/* Initialize options: set defaults, read config-file, etc */ /* Initialize options: set defaults, read config-file, etc */
int clicon_options_main(clicon_handle h); int clicon_options_main(clicon_handle h);

View file

@ -85,13 +85,13 @@ int api_path2xml(char *api_path, yang_stmt *yspec, cxobj *xtop,
cxobj **xpathp, yang_stmt **ypathp, cxobj **xerr); cxobj **xpathp, yang_stmt **ypathp, cxobj **xerr);
int xml2api_path_1(cxobj *x, cbuf *cb); int xml2api_path_1(cxobj *x, cbuf *cb);
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
int clixon_xml_find_api_path(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, char *format, int clixon_xml_find_api_path(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format,
...) __attribute__ ((format (printf, 5, 6)));; ...) __attribute__ ((format (printf, 5, 6)));;
int clixon_xml_find_instance_id(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, char *format, int clixon_xml_find_instance_id(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format,
...) __attribute__ ((format (printf, 5, 6)));; ...) __attribute__ ((format (printf, 5, 6)));;
#else #else
int clixon_xml_find_api_path(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, char *format, ...); int clixon_xml_find_api_path(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format, ...);
int clixon_xml_find_instance_id(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, char *format, ...); int clixon_xml_find_instance_id(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format, ...);
#endif #endif
#endif /* _CLIXON_PATH_H_ */ #endif /* _CLIXON_PATH_H_ */

View file

@ -179,7 +179,7 @@ typedef char *(cli_prompthook_t)(clicon_handle, char *mode);
* @retval -1 Error * @retval -1 Error
* @retval 0 OK * @retval 0 OK
*/ */
typedef int (datastore_upgrade_t)(clicon_handle h, char *db, cxobj *xt, modstate_diff_t *msd); typedef int (datastore_upgrade_t)(clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
/*! Startup status for use in startup-callback /*! Startup status for use in startup-callback
* Note that for STARTUP_ERR and _INVALID, running runs in failsafe mode * Note that for STARTUP_ERR and _INVALID, running runs in failsafe mode
@ -284,11 +284,11 @@ clixon_plugin *clixon_plugin_each(clicon_handle h, clixon_plugin *cpprev);
clixon_plugin *clixon_plugin_each_revert(clicon_handle h, clixon_plugin *cpprev, int nr); clixon_plugin *clixon_plugin_each_revert(clicon_handle h, clixon_plugin *cpprev, int nr);
clixon_plugin *clixon_plugin_find(clicon_handle h, char *name); clixon_plugin *clixon_plugin_find(clicon_handle h, const char *name);
int clixon_plugins_load(clicon_handle h, char *function, char *dir, char *regexp); int clixon_plugins_load(clicon_handle h, const char *function, const char *dir, const char *regexp);
int clixon_pseudo_plugin(clicon_handle h, char *name, clixon_plugin **cpp); int clixon_pseudo_plugin(clicon_handle h, const char *name, clixon_plugin **cpp);
int clixon_plugin_start_one(clixon_plugin *cp, clicon_handle h); int clixon_plugin_start_one(clixon_plugin *cp, clicon_handle h);
int clixon_plugin_start_all(clicon_handle h); int clixon_plugin_start_all(clicon_handle h);
@ -302,16 +302,16 @@ int clixon_plugin_auth_all(clicon_handle h, void *arg);
int clixon_plugin_extension_one(clixon_plugin *cp, clicon_handle h, yang_stmt *yext, yang_stmt *ys); int clixon_plugin_extension_one(clixon_plugin *cp, clicon_handle h, yang_stmt *yext, yang_stmt *ys);
int clixon_plugin_extension_all(clicon_handle h, yang_stmt *yext, yang_stmt *ys); int clixon_plugin_extension_all(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
int clixon_plugin_datastore_upgrade_one(clixon_plugin *cp, clicon_handle h, char *db, cxobj *xt, modstate_diff_t *msd); int clixon_plugin_datastore_upgrade_one(clixon_plugin *cp, clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
int clixon_plugin_datastore_upgrade_all(clicon_handle h, char *db, cxobj *xt, modstate_diff_t *msd); int clixon_plugin_datastore_upgrade_all(clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
/* rpc callback API */ /* rpc callback API */
int rpc_callback_register(clicon_handle h, clicon_rpc_cb cb, void *arg, char *ns, char *name); int rpc_callback_register(clicon_handle h, clicon_rpc_cb cb, void *arg, const char *ns, const char *name);
int rpc_callback_delete_all(clicon_handle h); int rpc_callback_delete_all(clicon_handle h);
int rpc_callback_call(clicon_handle h, cxobj *xe, cbuf *cbret, void *arg); int rpc_callback_call(clicon_handle h, cxobj *xe, cbuf *cbret, void *arg);
/* upgrade callback API */ /* upgrade callback API */
int upgrade_callback_reg_fn(clicon_handle h, clicon_upgrade_cb cb, const char *strfn, char *ns, void *arg); int upgrade_callback_reg_fn(clicon_handle h, clicon_upgrade_cb cb, const char *strfn, const char *ns, void *arg);
int upgrade_callback_delete_all(clicon_handle h); int upgrade_callback_delete_all(clicon_handle h);
int upgrade_callback_call(clicon_handle h, cxobj *xt, char *ns, uint16_t op, uint32_t from, uint32_t to, cbuf *cbret); int upgrade_callback_call(clicon_handle h, cxobj *xt, char *ns, uint16_t op, uint32_t from, uint32_t to, cbuf *cbret);

View file

@ -2,7 +2,9 @@
* *
***** BEGIN LICENSE BLOCK ***** ***** BEGIN LICENSE BLOCK *****
Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
Copyright (C) 2017-2019 Olof Hagsand
Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate)
This file is part of CLIXON. This file is part of CLIXON.
@ -63,9 +65,9 @@ char *format_int2str(enum format_enum showas);
enum format_enum format_str2int(char *str); enum format_enum format_str2int(char *str);
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
struct clicon_msg *clicon_msg_encode(uint32_t id, char *format, ...) __attribute__ ((format (printf, 2, 3))); struct clicon_msg *clicon_msg_encode(uint32_t id, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
#else #else
struct clicon_msg *clicon_msg_encode(uint32_t id, char *format, ...); struct clicon_msg *clicon_msg_encode(uint32_t id, const char *format, ...);
#endif #endif
int clicon_msg_decode(struct clicon_msg *msg, yang_stmt *yspec, uint32_t *id, cxobj **xml, cxobj **xerr); int clicon_msg_decode(struct clicon_msg *msg, yang_stmt *yspec, uint32_t *id, cxobj **xml, cxobj **xerr);

View file

@ -92,11 +92,11 @@ char *clicon_strjoin (int argc, char **argv, char *delim);
int clixon_strsplit(char *nodeid, const int delim, char **prefix, char **id); int clixon_strsplit(char *nodeid, const int delim, char **prefix, char **id);
int str2cvec(char *string, char delim1, char delim2, cvec **cvp); int str2cvec(char *string, char delim1, char delim2, cvec **cvp);
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
int uri_percent_encode(char **encp, char *fmt, ...) __attribute__ ((format (printf, 2, 3))); int uri_percent_encode(char **encp, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
int xml_chardata_encode(char **escp, char *fmt, ... ) __attribute__ ((format (printf, 2, 3))); int xml_chardata_encode(char **escp, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
#else #else
int uri_percent_encode(char **encp, char *str, ...); int uri_percent_encode(char **encp, const char *str, ...);
int xml_chardata_encode(char **escp, char *fmt, ...); int xml_chardata_encode(char **escp, const char *fmt, ...);
#endif #endif
int xml_chardata_cbuf_append(cbuf *cb, char *str); int xml_chardata_cbuf_append(cbuf *cb, char *str);
int uri_percent_decode(char *enc, char **str); int uri_percent_decode(char *enc, char **str);

View file

@ -213,12 +213,12 @@ int xml_enumerate_get(cxobj *x);
char *xml_body(cxobj *xn); char *xml_body(cxobj *xn);
cxobj *xml_body_get(cxobj *xn); cxobj *xml_body_get(cxobj *xn);
char *xml_find_type_value(cxobj *xn_parent, char *prefix, char *xml_find_type_value(cxobj *xn_parent, const char *prefix,
char *name, enum cxobj_type type); const char *name, enum cxobj_type type);
cxobj *xml_find_type(cxobj *xn_parent, char *prefix, char *name, enum cxobj_type type); cxobj *xml_find_type(cxobj *xn_parent, const char *prefix, const char *name, enum cxobj_type type);
char *xml_find_value(cxobj *xn_parent, char *name); char *xml_find_value(cxobj *xn_parent, const char *name);
char *xml_find_body(cxobj *xn, char *name); char *xml_find_body(cxobj *xn, const char *name);
cxobj *xml_find_body_obj(cxobj *xt, char *name, char *val); cxobj *xml_find_body_obj(cxobj *xt, const char *name, char *val);
int xml_free(cxobj *xn); int xml_free(cxobj *xn);
@ -239,9 +239,9 @@ int xml_operation(char *opstr, enum operation_type *op);
char *xml_operation2str(enum operation_type op); char *xml_operation2str(enum operation_type op);
int xml_attr_insert2val(char *instr, enum insert_type *ins); int xml_attr_insert2val(char *instr, enum insert_type *ins);
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
int clicon_log_xml(int level, cxobj *x, char *format, ...) __attribute__ ((format (printf, 3, 4))); int clicon_log_xml(int level, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
#else #else
int clicon_log_xml(int level, cxobj *x, char *format, ...); int clicon_log_xml(int level, cxobj *x, const char *format, ...);
#endif #endif
#ifdef XML_EXPLICIT_INDEX #ifdef XML_EXPLICIT_INDEX
int xml_search_index_p(cxobj *x); int xml_search_index_p(cxobj *x);

View file

@ -129,17 +129,17 @@ int xpath_tree2cbuf(xpath_tree *xs, cbuf *xpathcb);
int xpath_tree_eq(xpath_tree *xt1, xpath_tree *xt2, xpath_tree ***vec, size_t *len); int xpath_tree_eq(xpath_tree *xt1, xpath_tree *xt2, xpath_tree ***vec, size_t *len);
xpath_tree *xpath_tree_traverse(xpath_tree *xt, ...); xpath_tree *xpath_tree_traverse(xpath_tree *xt, ...);
int xpath_tree_free(xpath_tree *xs); int xpath_tree_free(xpath_tree *xs);
int xpath_parse(char *xpath, xpath_tree **xptree); int xpath_parse(const char *xpath, xpath_tree **xptree);
int xpath_vec_ctx(cxobj *xcur, cvec *nsc, char *xpath, int localonly, xp_ctx **xrp); int xpath_vec_ctx(cxobj *xcur, cvec *nsc, const char *xpath, int localonly, xp_ctx **xrp);
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
int xpath_vec_bool(cxobj *xcur, cvec *nsc, char *xpformat, ...) __attribute__ ((format (printf, 3, 4))); int xpath_vec_bool(cxobj *xcur, cvec *nsc, const char *xpformat, ...) __attribute__ ((format (printf, 3, 4)));
int xpath_vec_flag(cxobj *xcur, cvec *nsc, char *xpformat, uint16_t flags, int xpath_vec_flag(cxobj *xcur, cvec *nsc, const char *xpformat, uint16_t flags,
cxobj ***vec, int *veclen, ...) __attribute__ ((format (printf, 3, 7))); cxobj ***vec, int *veclen, ...) __attribute__ ((format (printf, 3, 7)));
#else #else
int xpath_vec_bool(cxobj *xcur, cvec *nsc, char *xpformat, ...); int xpath_vec_bool(cxobj *xcur, cvec *nsc, const char *xpformat, ...);
int xpath_vec_flag(cxobj *xcur, cvec *nsc, char *xpformat, uint16_t flags, int xpath_vec_flag(cxobj *xcur, cvec *nsc, const char *xpformat, uint16_t flags,
cxobj ***vec, int *veclen, ...); cxobj ***vec, int *veclen, ...);
#endif #endif
@ -149,15 +149,15 @@ int xpath_vec_flag(cxobj *xcur, cvec *nsc, char *xpformat, uint16_t flags,
* If you do not know what a namespace context is, see README.md#xml-and-xpath * If you do not know what a namespace context is, see README.md#xml-and-xpath
*/ */
#if defined(__GNUC__) && __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
cxobj *xpath_first(cxobj *xcur, cvec *nsc, char *xpformat, ...) __attribute__ ((format (printf, 3, 4))); cxobj *xpath_first(cxobj *xcur, cvec *nsc, const char *xpformat, ...) __attribute__ ((format (printf, 3, 4)));
cxobj *xpath_first_localonly(cxobj *xcur, char *xpformat, ...) __attribute__ ((format (printf, 2, 3))); cxobj *xpath_first_localonly(cxobj *xcur, const char *xpformat, ...) __attribute__ ((format (printf, 2, 3)));
int xpath_vec(cxobj *xcur, cvec *nsc, char *xpformat, cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 3, 6))); int xpath_vec(cxobj *xcur, cvec *nsc, const char *xpformat, cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 3, 6)));
#else #else
cxobj *xpath_first(cxobj *xcur, cvec *nsc, char *xpformat, ...); cxobj *xpath_first(cxobj *xcur, cvec *nsc, const char *xpformat, ...);
cxobj *xpath_first_localonly(cxobj *xcur, char *xpformat, ...); cxobj *xpath_first_localonly(cxobj *xcur, const char *xpformat, ...);
int xpath_vec(cxobj *xcur, cvec *nsc, char *xpformat, cxobj ***vec, size_t *veclen, ...); int xpath_vec(cxobj *xcur, cvec *nsc, const char *xpformat, cxobj ***vec, size_t *veclen, ...);
#endif #endif
int xpath2canonical(char *xpath0, cvec *nsc0, yang_stmt *yspec, char **xpath1, cvec **nsc1); int xpath2canonical(const char *xpath0, cvec *nsc0, yang_stmt *yspec, char **xpath1, cvec **nsc1);
#endif /* _CLIXON_XPATH_H */ #endif /* _CLIXON_XPATH_H */

View file

@ -88,7 +88,7 @@
*/ */
int int
clicon_data_get(clicon_handle h, clicon_data_get(clicon_handle h,
char *name, const char *name,
char **val) char **val)
{ {
clicon_hash_t *cdat = clicon_data(h); clicon_hash_t *cdat = clicon_data(h);
@ -110,7 +110,7 @@ clicon_data_get(clicon_handle h,
*/ */
int int
clicon_data_set(clicon_handle h, clicon_data_set(clicon_handle h,
char *name, const char *name,
char *val) char *val)
{ {
clicon_hash_t *cdat = clicon_data(h); clicon_hash_t *cdat = clicon_data(h);
@ -127,7 +127,7 @@ clicon_data_set(clicon_handle h,
*/ */
int int
clicon_data_del(clicon_handle h, clicon_data_del(clicon_handle h,
char *name) const char *name)
{ {
clicon_hash_t *cdat = clicon_data(h); clicon_hash_t *cdat = clicon_data(h);

View file

@ -427,7 +427,7 @@ static int
xmldb_get_nocache(clicon_handle h, xmldb_get_nocache(clicon_handle h,
const char *db, const char *db,
cvec *nsc, cvec *nsc,
char *xpath, const char *xpath,
cxobj **xtop, cxobj **xtop,
modstate_diff_t *msdiff) modstate_diff_t *msdiff)
{ {
@ -511,7 +511,7 @@ static int
xmldb_get_cache(clicon_handle h, xmldb_get_cache(clicon_handle h,
const char *db, const char *db,
cvec *nsc, cvec *nsc,
char *xpath, const char *xpath,
cxobj **xtop, cxobj **xtop,
modstate_diff_t *msdiff) modstate_diff_t *msdiff)
{ {
@ -612,7 +612,7 @@ static int
xmldb_get_zerocopy(clicon_handle h, xmldb_get_zerocopy(clicon_handle h,
const char *db, const char *db,
cvec *nsc, cvec *nsc,
char *xpath, const char *xpath,
cxobj **xtop, cxobj **xtop,
modstate_diff_t *msdiff) modstate_diff_t *msdiff)
{ {
@ -726,7 +726,7 @@ int
xmldb_get0(clicon_handle h, xmldb_get0(clicon_handle h,
const char *db, const char *db,
cvec *nsc, cvec *nsc,
char *xpath, const char *xpath,
int copy, int copy,
cxobj **xret, cxobj **xret,
modstate_diff_t *msdiff) modstate_diff_t *msdiff)

View file

@ -149,7 +149,7 @@ int clicon_err_fn(const char *fn,
const int line, const int line,
int category, int category,
int suberr, int suberr,
char *format, ...) const char *format, ...)
{ {
va_list args; va_list args;
int len; int len;

View file

@ -257,8 +257,8 @@ clicon_log_str(int level,
* @see clicon_log_init and clicon_log_str * @see clicon_log_init and clicon_log_str
*/ */
int int
clicon_log(int level, clicon_log(int level,
char *format, ...) const char *format, ...)
{ {
va_list args; va_list args;
int len; int len;
@ -338,8 +338,8 @@ clicon_debug_get(void)
* @param[in] format Message to print as argv. * @param[in] format Message to print as argv.
*/ */
int int
clicon_debug(int dbglevel, clicon_debug(int dbglevel,
char *format, ...) const char *format, ...)
{ {
va_list args; va_list args;
int len; int len;

View file

@ -327,7 +327,7 @@ parse_configfile(clicon_handle h,
*/ */
int int
clicon_option_add(clicon_handle h, clicon_option_add(clicon_handle h,
char *name, const char *name,
char *value) char *value)
{ {
int retval = -1; int retval = -1;

View file

@ -1529,7 +1529,7 @@ clixon_xml_find_api_path(cxobj *xt,
yang_stmt *yt, yang_stmt *yt,
cxobj ***xvec, cxobj ***xvec,
int *xlen, int *xlen,
char *format, const char *format,
...) ...)
{ {
int retval = -1; int retval = -1;
@ -1623,7 +1623,7 @@ clixon_xml_find_instance_id(cxobj *xt,
yang_stmt *yt, yang_stmt *yt,
cxobj ***xvec, cxobj ***xvec,
int *xlen, int *xlen,
char *format, const char *format,
...) ...)
{ {
int retval = -1; int retval = -1;

View file

@ -159,7 +159,7 @@ clixon_plugin_each_revert(clicon_handle h,
*/ */
clixon_plugin * clixon_plugin *
clixon_plugin_find(clicon_handle h, clixon_plugin_find(clicon_handle h,
char *name) const char *name)
{ {
int i; int i;
clixon_plugin *cp = NULL; clixon_plugin *cp = NULL;
@ -185,8 +185,8 @@ clixon_plugin_find(clicon_handle h,
*/ */
static int static int
plugin_load_one(clicon_handle h, plugin_load_one(clicon_handle h,
char *file, char *file, /* note modified */
char *function, const char *function,
int dlflags, int dlflags,
clixon_plugin **cpp) clixon_plugin **cpp)
{ {
@ -267,9 +267,9 @@ plugin_load_one(clicon_handle h,
*/ */
int int
clixon_plugins_load(clicon_handle h, clixon_plugins_load(clicon_handle h,
char *function, const char *function,
char *dir, const char *dir,
char *regexp) const char *regexp)
{ {
int retval = -1; int retval = -1;
int ndp; int ndp;
@ -316,7 +316,7 @@ done:
*/ */
int int
clixon_pseudo_plugin(clicon_handle h, clixon_pseudo_plugin(clicon_handle h,
char *name, const char *name,
clixon_plugin **cpp) clixon_plugin **cpp)
{ {
int retval = -1; int retval = -1;
@ -595,7 +595,7 @@ clixon_plugin_extension_all(clicon_handle h,
int int
clixon_plugin_datastore_upgrade_one(clixon_plugin *cp, clixon_plugin_datastore_upgrade_one(clixon_plugin *cp,
clicon_handle h, clicon_handle h,
char *db, const char *db,
cxobj *xt, cxobj *xt,
modstate_diff_t *msd) modstate_diff_t *msd)
@ -628,7 +628,7 @@ clixon_plugin_datastore_upgrade_one(clixon_plugin *cp,
*/ */
int int
clixon_plugin_datastore_upgrade_all(clicon_handle h, clixon_plugin_datastore_upgrade_all(clicon_handle h,
char *db, const char *db,
cxobj *xt, cxobj *xt,
modstate_diff_t *msd) modstate_diff_t *msd)
{ {
@ -682,8 +682,8 @@ int
rpc_callback_register(clicon_handle h, rpc_callback_register(clicon_handle h,
clicon_rpc_cb cb, clicon_rpc_cb cb,
void *arg, void *arg,
char *ns, const char *ns,
char *name) const char *name)
{ {
rpc_callback_t *rc = NULL; rpc_callback_t *rc = NULL;
@ -813,7 +813,7 @@ int
upgrade_callback_reg_fn(clicon_handle h, upgrade_callback_reg_fn(clicon_handle h,
clicon_upgrade_cb cb, clicon_upgrade_cb cb,
const char *fnstr, const char *fnstr,
char *ns, const char *ns,
void *arg) void *arg)
{ {
upgrade_callback_t *uc; upgrade_callback_t *uc;

View file

@ -136,7 +136,7 @@ format_str2int(char *str)
*/ */
struct clicon_msg * struct clicon_msg *
clicon_msg_encode(uint32_t id, clicon_msg_encode(uint32_t id,
char *format, ...) const char *format, ...)
{ {
va_list args; va_list args;
uint32_t xmllen; uint32_t xmllen;

View file

@ -244,7 +244,7 @@ uri_unreserved(unsigned char in)
*/ */
int int
uri_percent_encode(char **encp, uri_percent_encode(char **encp,
char *fmt, ...) const char *fmt, ...)
{ {
int retval = -1; int retval = -1;
char *str = NULL; /* Expanded format string w stdarg */ char *str = NULL; /* Expanded format string w stdarg */
@ -370,8 +370,8 @@ uri_percent_decode(char *enc,
* @see xml_chardata_cbuf_append for a specialized version * @see xml_chardata_cbuf_append for a specialized version
*/ */
int int
xml_chardata_encode(char **escp, xml_chardata_encode(char **escp,
char *fmt,...) const char *fmt,...)
{ {
int retval = -1; int retval = -1;
char *str = NULL; /* Expanded format string w stdarg */ char *str = NULL; /* Expanded format string w stdarg */

View file

@ -1661,8 +1661,8 @@ xml_body_get(cxobj *xt)
*/ */
char * char *
xml_find_type_value(cxobj *xt, xml_find_type_value(cxobj *xt,
char *prefix, const char *prefix,
char *name, const char *name,
enum cxobj_type type) enum cxobj_type type)
{ {
cxobj *x; cxobj *x;
@ -1691,8 +1691,8 @@ xml_find_type_value(cxobj *xt,
*/ */
cxobj * cxobj *
xml_find_type(cxobj *xt, xml_find_type(cxobj *xt,
char *prefix, const char *prefix,
char *name, const char *name,
enum cxobj_type type) enum cxobj_type type)
{ {
cxobj *x = NULL; cxobj *x = NULL;
@ -1730,8 +1730,8 @@ xml_find_type(cxobj *xt,
* return x_value * return x_value
*/ */
char * char *
xml_find_value(cxobj *xt, xml_find_value(cxobj *xt,
char *name) const char *name)
{ {
cxobj *x = NULL; cxobj *x = NULL;
@ -1755,8 +1755,8 @@ xml_find_value(cxobj *xt,
* x_name=name return x_value * x_name=name return x_value
*/ */
char * char *
xml_find_body(cxobj *xt, xml_find_body(cxobj *xt,
char *name) const char *name)
{ {
cxobj *x=NULL; cxobj *x=NULL;
@ -1783,9 +1783,9 @@ xml_find_body(cxobj *xt,
* return x * return x
*/ */
cxobj * cxobj *
xml_find_body_obj(cxobj *xt, xml_find_body_obj(cxobj *xt,
char *name, const char *name,
char *val) char *val)
{ {
cxobj *x = NULL; cxobj *x = NULL;
char *bstr; char *bstr;
@ -2315,9 +2315,9 @@ xml_attr_insert2val(char *instr,
* @param[in] format Message to print as argv. * @param[in] format Message to print as argv.
*/ */
int int
clicon_log_xml(int level, clicon_log_xml(int level,
cxobj *x, cxobj *x,
char *format, ...) const char *format, ...)
{ {
va_list args; va_list args;
int len; int len;

View file

@ -483,7 +483,7 @@ xpath_tree_free(xpath_tree *xs)
* @see xpath_tree_free * @see xpath_tree_free
*/ */
int int
xpath_parse(char *xpath, xpath_parse(const char *xpath,
xpath_tree **xptree) xpath_tree **xptree)
{ {
int retval = -1; int retval = -1;
@ -541,11 +541,11 @@ xpath_parse(char *xpath,
* @endcode * @endcode
*/ */
int int
xpath_vec_ctx(cxobj *xcur, xpath_vec_ctx(cxobj *xcur,
cvec *nsc, cvec *nsc,
char *xpath, const char *xpath,
int localonly, int localonly,
xp_ctx **xrp) xp_ctx **xrp)
{ {
int retval = -1; int retval = -1;
xpath_tree *xptree = NULL; xpath_tree *xptree = NULL;
@ -591,9 +591,9 @@ xpath_vec_ctx(cxobj *xcur,
* @see also xpath_vec. * @see also xpath_vec.
*/ */
cxobj * cxobj *
xpath_first(cxobj *xcur, xpath_first(cxobj *xcur,
cvec *nsc, cvec *nsc,
char *xpformat, const char *xpformat,
...) ...)
{ {
cxobj *cx = NULL; cxobj *cx = NULL;
@ -651,8 +651,8 @@ xpath_first(cxobj *xcur,
* @see also xpath_first. * @see also xpath_first.
*/ */
cxobj * cxobj *
xpath_first_localonly(cxobj *xcur, xpath_first_localonly(cxobj *xcur,
char *xpformat, const char *xpformat,
...) ...)
{ {
cxobj *cx = NULL; cxobj *cx = NULL;
@ -712,11 +712,11 @@ xpath_first_localonly(cxobj *xcur,
* @endcode * @endcode
*/ */
int int
xpath_vec(cxobj *xcur, xpath_vec(cxobj *xcur,
cvec *nsc, cvec *nsc,
char *xpformat, const char *xpformat,
cxobj ***vec, cxobj ***vec,
size_t *veclen, size_t *veclen,
...) ...)
{ {
int retval = -1; int retval = -1;
@ -784,12 +784,12 @@ xpath_vec(cxobj *xcur,
* @see also xpath_vec This is a specialized version. * @see also xpath_vec This is a specialized version.
*/ */
int int
xpath_vec_flag(cxobj *xcur, xpath_vec_flag(cxobj *xcur,
cvec *nsc, cvec *nsc,
char *xpformat, const char *xpformat,
uint16_t flags, uint16_t flags,
cxobj ***vec, cxobj ***vec,
int *veclen, int *veclen,
...) ...)
{ {
int retval = -1; int retval = -1;
@ -847,9 +847,9 @@ xpath_vec_flag(cxobj *xcur,
* @retval -1 Error * @retval -1 Error
*/ */
int int
xpath_vec_bool(cxobj *xcur, xpath_vec_bool(cxobj *xcur,
cvec *nsc, cvec *nsc,
char *xpformat, const char *xpformat,
...) ...)
{ {
int retval = -1; int retval = -1;
@ -970,7 +970,7 @@ traverse_canonical(xpath_tree *xs,
* @endcode * @endcode
*/ */
int int
xpath2canonical(char *xpath0, xpath2canonical(const char *xpath0,
cvec *nsc0, cvec *nsc0,
yang_stmt *yspec, yang_stmt *yspec,
char **xpath1, char **xpath1,

View file

@ -43,7 +43,7 @@
struct clixon_xpath_yacc{ struct clixon_xpath_yacc{
const char *xpy_name; /* Name of syntax (for error string) */ const char *xpy_name; /* Name of syntax (for error string) */
int xpy_linenum; /* Number of \n in parsed buffer */ int xpy_linenum; /* Number of \n in parsed buffer */
char *xpy_parse_string; /* original (copy of) parse string */ const char *xpy_parse_string; /* original (copy of) parse string */
void *xpy_lexbuf; /* internal parse buffer from lex */ void *xpy_lexbuf; /* internal parse buffer from lex */
xpath_tree *xpy_top; xpath_tree *xpy_top;
}; };

View file

@ -50,7 +50,7 @@ netconf_client_rpc(clicon_handle h,
char *ns; char *ns;
/* get namespace from rpc name, return back in each output parameter */ /* get namespace from rpc name, return back in each output parameter */
if ((ns = xml_find_type_value(xe, NULL, (char*)"xmlns", CX_ATTR)) == NULL){ if ((ns = xml_find_type_value(xe, NULL, "xmlns", CX_ATTR)) == NULL){
clicon_err(OE_XML, ENOENT, "No namespace given in rpc %s", xml_name(xe)); clicon_err(OE_XML, ENOENT, "No namespace given in rpc %s", xml_name(xe));
goto done; goto done;
} }
@ -94,10 +94,10 @@ clixon_plugin_init(clicon_handle h)
api_initialization(); api_initialization();
clicon_debug(1, (char*)"%s netconf", __FUNCTION__); clicon_debug(1, "%s netconf", __FUNCTION__);
/* Register local netconf rpc client (note not backend rpc client) */ /* Register local netconf rpc client (note not backend rpc client) */
if (rpc_callback_register(h, netconf_client_rpc, NULL, if (rpc_callback_register(h, netconf_client_rpc, NULL,
(char*)"urn:example:clixon", (char*)"client-rpc") < 0) "urn:example:clixon", "client-rpc") < 0)
return NULL; return NULL;
return &api; return &api;
} }