{"thread":{"id":"4690","subject":"[PATCH] Make some strings const","startedAt":"2006-06-28T09:04:39Z","lastAt":"2006-06-28T09:04:39Z","messageCount":1,"participants":["Timo Hirvonen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22716","messageId":"20060628120439.e60d7e15.tihirvon@gmail.com","threadId":"4690","inReplyTo":null,"subject":"[PATCH] Make some strings const","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-06-28T09:04:39Z","receivedAt":"2006-06-28T09:04:39Z","isPatch":true,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>\n---\n builtin-mailinfo.c  |    2 +-\n builtin-rev-parse.c |    2 +-\n commit.c            |    2 +-\n connect.c           |    4 ++--\n daemon.c            |    4 ++--\n describe.c          |    2 +-\n git.c               |    3 ++-\n http-push.c         |    4 ++--\n imap-send.c         |    2 +-\n sha1_file.c         |    2 +-\n upload-pack.c       |    4 ++--\n 11 files changed, 16 insertions(+), 15 deletions(-)\n\ndiff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\nindex 821642a..3e40747 100644\n--- a/builtin-mailinfo.c\n+++ b/builtin-mailinfo.c\n@@ -165,7 +165,7 @@ static int handle_subject(char *line)\n \n static int slurp_attr(const char *line, const char *name, char *attr)\n {\n-\tchar *ends, *ap = strcasestr(line, name);\n+\tconst char *ends, *ap = strcasestr(line, name);\n \tsize_t sz;\n \n \tif (!ap) {\ndiff --git a/builtin-rev-parse.c b/builtin-rev-parse.c\nindex b27a6d3..5f5ade4 100644\n--- a/builtin-rev-parse.c\n+++ b/builtin-rev-parse.c\n@@ -329,7 +329,7 @@ int cmd_rev_parse(int argc, const char *\n \t\tdotdot = strstr(arg, \"..\");\n \t\tif (dotdot) {\n \t\t\tunsigned char end[20];\n-\t\t\tchar *next = dotdot + 2;\n+\t\t\tconst char *next = dotdot + 2;\n \t\t\tconst char *this = arg;\n \t\t\t*dotdot = 0;\n \t\t\tif (!*next)\ndiff --git a/commit.c b/commit.c\nindex 946615d..0327df1 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -543,7 +543,7 @@ static int add_merge_info(enum cmit_fmt \n \t\tconst char *hex = abbrev\n \t\t\t? find_unique_abbrev(p->object.sha1, abbrev)\n \t\t\t: sha1_to_hex(p->object.sha1);\n-\t\tchar *dots = (abbrev && strlen(hex) != 40) ? \"...\" : \"\";\n+\t\tconst char *dots = (abbrev && strlen(hex) != 40) ? \"...\" : \"\";\n \t\tparent = parent->next;\n \n \t\toffset += sprintf(buf + offset, \" %s%s\", hex, dots);\ndiff --git a/connect.c b/connect.c\nindex 66e78a2..f9d9202 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -330,7 +330,7 @@ static int git_tcp_connect_sock(char *ho\n {\n \tint sockfd = -1;\n \tchar *colon, *end;\n-\tchar *port = STR(DEFAULT_GIT_PORT);\n+\tconst char *port = STR(DEFAULT_GIT_PORT);\n \tstruct addrinfo hints, *ai0, *ai;\n \tint gai;\n \n@@ -525,7 +525,7 @@ static int git_use_proxy(const char *hos\n static void git_proxy_connect(int fd[2],\n \t\t\t      const char *prog, char *host, char *path)\n {\n-\tchar *port = STR(DEFAULT_GIT_PORT);\n+\tconst char *port = STR(DEFAULT_GIT_PORT);\n \tchar *colon, *end;\n \tint pipefd[2][2];\n \tpid_t pid;\ndiff --git a/daemon.c b/daemon.c\nindex 1ba4d66..e096bd7 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -35,7 +35,7 @@ static char *base_path = NULL;\n  * after ~user/.  E.g. a request to git://host/~alice/frotz would\n  * go to /home/alice/pub_git/frotz with --user-path=pub_git.\n  */\n-static char *user_path = NULL;\n+static const char *user_path = NULL;\n \n /* Timeout, and initial timeout */\n static unsigned int timeout = 0;\n@@ -472,7 +472,7 @@ static void child_handler(int signo)\n \t\t\tchildren_reaped = reaped + 1;\n \t\t\t/* XXX: Custom logging, since we don't wanna getpid() */\n \t\t\tif (verbose) {\n-\t\t\t\tchar *dead = \"\";\n+\t\t\t\tconst char *dead = \"\";\n \t\t\t\tif (!WIFEXITED(status) || WEXITSTATUS(status) > 0)\n \t\t\t\t\tdead = \" (with error)\";\n \t\t\t\tif (log_syslog)\ndiff --git a/describe.c b/describe.c\nindex aa3434a..8e68d5d 100644\n--- a/describe.c\n+++ b/describe.c\n@@ -97,7 +97,7 @@ static int compare_names(const void *_a,\n \treturn (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;\n }\n \n-static void describe(char *arg, int last_one)\n+static void describe(const char *arg, int last_one)\n {\n \tunsigned char sha1[20];\n \tstruct commit *cmit;\ndiff --git a/git.c b/git.c\nindex 8b060e8..90b86a6 100644\n--- a/git.c\n+++ b/git.c\n@@ -17,7 +17,8 @@ #include \"builtin.h\"\n \n static void prepend_to_path(const char *dir, int len)\n {\n-\tchar *path, *old_path = getenv(\"PATH\");\n+\tconst char *old_path = getenv(\"PATH\");\n+\tchar *path;\n \tint path_len = len;\n \n \tif (!old_path)\ndiff --git a/http-push.c b/http-push.c\nindex 3c89a17..e281f70 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1274,7 +1274,7 @@ xml_cdata(void *userData, const XML_Char\n \tstrlcpy(ctx->cdata, s, len + 1);\n }\n \n-static struct remote_lock *lock_remote(char *path, long timeout)\n+static struct remote_lock *lock_remote(const char *path, long timeout)\n {\n \tstruct active_request_slot *slot;\n \tstruct slot_results results;\n@@ -2130,7 +2130,7 @@ static int remote_exists(const char *pat\n \treturn -1;\n }\n \n-static void fetch_symref(char *path, char **symref, unsigned char *sha1)\n+static void fetch_symref(const char *path, char **symref, unsigned char *sha1)\n {\n \tchar *url;\n \tstruct buffer buffer;\ndiff --git a/imap-send.c b/imap-send.c\nindex 94e39cd..65c71c6 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -242,7 +242,7 @@ socket_read( Socket_t *sock, char *buf, \n }\n \n static int\n-socket_write( Socket_t *sock, char *buf, int len )\n+socket_write( Socket_t *sock, const char *buf, int len )\n {\n \tint n = write( sock->fd, buf, len );\n \tif (n != len) {\ndiff --git a/sha1_file.c b/sha1_file.c\nindex c80528b..8179630 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -343,7 +343,7 @@ static void read_info_alternates(const c\n \n void prepare_alt_odb(void)\n {\n-\tchar *alt;\n+\tconst char *alt;\n \n \talt = getenv(ALTERNATE_DB_ENVIRONMENT);\n \tif (!alt) alt = \"\";\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 7b86f69..2b70c3d 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -95,8 +95,8 @@ static void create_pack_file(void)\n \t\tint i;\n \t\tint args;\n \t\tconst char **argv;\n+\t\tconst char **p;\n \t\tchar *buf;\n-\t\tchar **p;\n \n \t\tif (create_full_pack) {\n \t\t\targs = 10;\n@@ -441,7 +441,7 @@ static int receive_needs(void)\n \n static int send_ref(const char *refname, const unsigned char *sha1)\n {\n-\tstatic char *capabilities = \"multi_ack thin-pack side-band\";\n+\tstatic const char *capabilities = \"multi_ack thin-pack side-band\";\n \tstruct object *o = parse_object(sha1);\n \n \tif (!o)\n-- \n1.4.1.rc1.g1ef9\n"}]}