commit 49d691e8618234a8b0f8d05a1df882c31603644e from: Stefan Sperling via: Thomas Adam date: Sat Sep 25 22:38:40 2021 UTC mark some function parameters as 'const', as they should be; patch by Omar Polo commit - 6b78ad28aa9fd55e0c2ae44dea662944bbc279d7 commit + 49d691e8618234a8b0f8d05a1df882c31603644e blob - 5df90993cba5c1a4d76ffb9c84b57b860a51ed11 blob + 79337138861c4aa917c6cbb1552a0743dde3a958 --- lib/gitconfig.c +++ lib/gitconfig.c @@ -104,7 +104,7 @@ struct got_gitconfig { }; static __inline__ u_int8_t -conf_hash(char *s) +conf_hash(const char *s) { u_int8_t hash = 0; @@ -439,8 +439,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); @@ -478,7 +478,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; @@ -606,7 +607,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 - 465fc301b0dceaeef13bda6ff6eb82c76ed7eac6 blob + 9820c8bd9e58d215598df363fdb6e25fbd81323d --- libexec/got-read-gitconfig/got-read-gitconfig.c +++ libexec/got-read-gitconfig/got-read-gitconfig.c @@ -58,7 +58,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; @@ -83,7 +83,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;