commit fda3525ecfaa5f1d603ab52254172b68ad177ed1 from: Stefan Sperling date: Sat Sep 25 10:23:12 2021 UTC mark some function parameters as 'const', as they should be; patch by Omar Polo commit - f6764181d7e0fc68673b90cbc93d6064509d0bd7 commit + fda3525ecfaa5f1d603ab52254172b68ad177ed1 blob - 9b99340d822a3a7c9e2470194986699e4657f604 blob + a5c2c23ebfc28776e46ebd4b14022bf9b712e0e3 --- lib/gitconfig.c +++ lib/gitconfig.c @@ -103,7 +103,7 @@ struct got_gitconfig { }; static __inline__ u_int8_t -conf_hash(char *s) +conf_hash(const char *s) { u_int8_t hash = 0; @@ -438,8 +438,8 @@ fail: * if that tag does not exist. */ int -got_gitconfig_get_num(struct got_gitconfig *conf, char *section, char *tag, - int def) +got_gitconfig_get_num(struct got_gitconfig *conf, const char *section, + const char *tag, int def) { char *value = got_gitconfig_get_str(conf, section, tag); @@ -477,7 +477,8 @@ got_gitconfig_match_num(struct got_gitconfig *conf, ch /* Return the string value denoted by TAG in section SECTION. */ char * -got_gitconfig_get_str(struct got_gitconfig *conf, char *section, char *tag) +got_gitconfig_get_str(struct got_gitconfig *conf, const char *section, + const char *tag) { struct got_gitconfig_binding *cb; @@ -605,7 +606,7 @@ cleanup: } struct got_gitconfig_list * -got_gitconfig_get_tag_list(struct got_gitconfig *conf, char *section) +got_gitconfig_get_tag_list(struct got_gitconfig *conf, const char *section) { struct got_gitconfig_list *list = 0; struct got_gitconfig_list_node *node = 0; blob - 615d2690ac39f3fceb3704b2624a85e8de2ba65c blob + 7bfbb245c1c4fd6b4e56e6e71e28d6253c443930 --- lib/got_lib_gitconfig.h +++ lib/got_lib_gitconfig.h @@ -43,11 +43,12 @@ const struct got_error *got_gitconfig_get_section_list struct got_gitconfig_list **, struct got_gitconfig *); struct got_gitconfig_list *got_gitconfig_get_list(struct got_gitconfig *, char *, char *); -struct got_gitconfig_list *got_gitconfig_get_tag_list(struct got_gitconfig *, char *); -int got_gitconfig_get_num(struct got_gitconfig *, char *, char *, +struct got_gitconfig_list *got_gitconfig_get_tag_list(struct got_gitconfig *, + const char *); +int got_gitconfig_get_num(struct got_gitconfig *, const char *, const char *, int); -char *got_gitconfig_get_str(struct got_gitconfig *, char *, - char *); +char *got_gitconfig_get_str(struct got_gitconfig *, const char *, + const char *); const struct got_error *got_gitconfig_open(struct got_gitconfig **, int); void got_gitconfig_close(struct got_gitconfig *); int got_gitconfig_match_num(struct got_gitconfig *, char *, char *, int); blob - 3ce93f09be615d41528eb6af7e5f5a1bd77ce92f blob + a7d8b89126289ae87d2cfb9a6a8b0414e8cd9fc0 --- libexec/got-read-gitconfig/got-read-gitconfig.c +++ libexec/got-read-gitconfig/got-read-gitconfig.c @@ -59,7 +59,7 @@ send_gitconfig_int(struct imsgbuf *ibuf, int value) static const struct got_error * gitconfig_num_request(struct imsgbuf *ibuf, struct got_gitconfig *gitconfig, - char *section, char *tag, int def) + const char *section, const char *tag, int def) { int value; @@ -84,7 +84,7 @@ send_gitconfig_str(struct imsgbuf *ibuf, const char *v static const struct got_error * gitconfig_str_request(struct imsgbuf *ibuf, struct got_gitconfig *gitconfig, - char *section, char *tag) + const char *section, const char *tag) { char *value;