mark some function parameters as 'const', as they should be; patch by Omar Polo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
diff --git a/lib/gitconfig.c b/lib/gitconfig.c
index 9b99340..a5c2c23 100644
--- a/lib/gitconfig.c
+++ b/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, char *section, char *tag,
/* 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;
diff --git a/lib/got_lib_gitconfig.h b/lib/got_lib_gitconfig.h
index 615d269..7bfbb24 100644
--- a/lib/got_lib_gitconfig.h
+++ b/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);
diff --git a/libexec/got-read-gitconfig/got-read-gitconfig.c b/libexec/got-read-gitconfig/got-read-gitconfig.c
index 3ce93f0..a7d8b89 100644
--- a/libexec/got-read-gitconfig/got-read-gitconfig.c
+++ b/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 *value)
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;