]> mj.ucw.cz Git - libucw.git/commitdiff
Opt: Constification continues
authorMartin Mares <mj@ucw.cz>
Fri, 27 Jun 2014 14:57:00 +0000 (16:57 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 27 Jun 2014 14:57:00 +0000 (16:57 +0200)
ucw/opt-conf.c
ucw/opt-help.c
ucw/opt.h

index 3db998b9848f7064054cfd60512460d17e1852c7..c29f23b973dd2573c130646b463850605090f57e 100644 (file)
@@ -40,14 +40,14 @@ static void opt_conf_check(struct opt_context *oc)
   }
 }
 
-void opt_handle_config(struct opt_item * opt UNUSED, const char * value, void * data)
+void opt_handle_config(const struct opt_item * opt UNUSED, const char * value, void * data)
 {
   opt_conf_check(data);
   if (cf_load(value))
     exit(1);           // Error message is already printed by cf_load()
 }
 
-void opt_handle_set(struct opt_item * opt UNUSED, const char * value, void * data)
+void opt_handle_set(const struct opt_item * opt UNUSED, const char * value, void * data)
 {
   opt_conf_check(data);
   struct cf_context *cc = cf_get_context();
@@ -56,7 +56,7 @@ void opt_handle_set(struct opt_item * opt UNUSED, const char * value, void * dat
     opt_failure("Cannot set %s", value);
 }
 
-void opt_handle_dumpconfig(struct opt_item * opt UNUSED, const char * value UNUSED, void * data UNUSED)
+void opt_handle_dumpconfig(const struct opt_item * opt UNUSED, const char * value UNUSED, void * data UNUSED)
 {
   struct cf_context *cc = cf_get_context();
   opt_conf_end_of_options(cc);
@@ -66,7 +66,7 @@ void opt_handle_dumpconfig(struct opt_item * opt UNUSED, const char * value UNUS
   exit(0);
 }
 
-void opt_conf_hook_internal(struct opt_item * opt, uint event, const char * value UNUSED, void * data) {
+void opt_conf_hook_internal(const struct opt_item * opt, uint event, const char * value UNUSED, void * data) {
   struct opt_context *oc = data;
   struct cf_context *cc = cf_get_context();
 
index ff98223832d1b98c4565ccd60b5d423b820c4ff2..f71fec14d93bef28eafaeadcc8c6f8982e1be9d7 100644 (file)
@@ -156,7 +156,7 @@ void opt_help(const struct opt_section * sec) {
   mp_delete(h.pool);
 }
 
-void opt_handle_help(struct opt_item * opt UNUSED, const char * value UNUSED, void * data)
+void opt_handle_help(const struct opt_item * opt UNUSED, const char * value UNUSED, void * data)
 {
   struct opt_context *oc = data;
   opt_help(oc->options);
index 82c76bba7c5534051a3ae1191f25e985c1de01cb..695f607e421e9bbf5e81e31c19c165dbe09103ed 100644 (file)
--- a/ucw/opt.h
+++ b/ucw/opt.h
@@ -298,7 +298,7 @@ int opt_parse(const struct opt_section * options, char ** argv);
 void opt_failure(const char * mesg, ...) FORMAT_CHECK(printf,1,2) NONRET;
 
 void opt_help(const struct opt_section * sec);
-void opt_handle_help(struct opt_item * opt, const char * value, void * data);
+void opt_handle_help(const struct opt_item * opt, const char * value, void * data);
 
 /***
  * [[conf]]
@@ -347,10 +347,10 @@ void opt_handle_help(struct opt_item * opt, const char * value, void * data);
 #define OPT_CONF_DUMPCONFIG OPT_CALL(0, "dumpconfig", opt_handle_dumpconfig, NULL, OPT_INTERNAL | OPT_NO_VALUE, "\tDump program configuration")
 #define OPT_CONF_HOOK      OPT_HOOK(opt_conf_hook_internal, NULL, OPT_HOOK_BEFORE_VALUE | OPT_HOOK_FINAL | OPT_HOOK_INTERNAL)
 
-void opt_handle_config(struct opt_item * opt, const char * value, void * data);
-void opt_handle_set(struct opt_item * opt, const char * value, void * data);
-void opt_handle_dumpconfig(struct opt_item * opt, const char * value, void * data);
-void opt_conf_hook_internal(struct opt_item * opt, uint event, const char * value, void * data);
+void opt_handle_config(const struct opt_item * opt, const char * value, void * data);
+void opt_handle_set(const struct opt_item * opt, const char * value, void * data);
+void opt_handle_dumpconfig(const struct opt_item * opt, const char * value, void * data);
+void opt_conf_hook_internal(const struct opt_item * opt, uint event, const char * value, void * data);
 
 // XXX: This is duplicated with <ucw/getopt.h>, but that one will hopefully go away one day.
 /**