Improved const correctness for strings

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Shawn O. Pearce 2007-10-21 00:12:12 -04:00
parent 6e863d6d12
commit 538dfe7397
4 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ static int update_ref_env(const char *action,
unsigned char *oldval) unsigned char *oldval)
{ {
char msg[1024]; char msg[1024];
char *rla = getenv("GIT_REFLOG_ACTION"); const char *rla = getenv("GIT_REFLOG_ACTION");
if (!rla) if (!rla)
rla = "(reflog update)"; rla = "(reflog update)";
@ -61,7 +61,7 @@ static int update_local_ref(const char *name,
} }
if (get_sha1(name, sha1_old)) { if (get_sha1(name, sha1_old)) {
char *msg; const char *msg;
just_store: just_store:
/* new ref */ /* new ref */
if (!strncmp(name, "refs/tags/", 10)) if (!strncmp(name, "refs/tags/", 10))

View File

@ -288,7 +288,7 @@ static void cleanup_space(char *buf)
} }
static void decode_header(char *it, unsigned itsize); static void decode_header(char *it, unsigned itsize);
static char *header[MAX_HDR_PARSED] = { static const char *header[MAX_HDR_PARSED] = {
"From","Subject","Date", "From","Subject","Date",
}; };

View File

@ -169,7 +169,7 @@ static void prepend_reflog_action(const char *action, char *buf, size_t size)
} }
enum reset_type { MIXED, SOFT, HARD, NONE }; enum reset_type { MIXED, SOFT, HARD, NONE };
static char *reset_type_names[] = { "mixed", "soft", "hard", NULL }; static const char *reset_type_names[] = { "mixed", "soft", "hard", NULL };
int cmd_reset(int argc, const char **argv, const char *prefix) int cmd_reset(int argc, const char **argv, const char *prefix)
{ {

View File

@ -132,7 +132,7 @@ static void match_trees(const unsigned char *hash1,
const unsigned char *hash2, const unsigned char *hash2,
int *best_score, int *best_score,
char **best_match, char **best_match,
char *base, const char *base,
int recurse_limit) int recurse_limit)
{ {
struct tree_desc one; struct tree_desc one;