* [PATCH 1/7] avoid to use error that shadows the function name, use err instead.
@ 2006-08-23 10:39 Pierre Habouzit
2006-08-23 10:39 ` [PATCH 2/7] git_dir holds pointers to local strings, hence MUST be const Pierre Habouzit
0 siblings, 1 reply; 7+ messages in thread
From: Pierre Habouzit @ 2006-08-23 10:39 UTC (permalink / raw)
To: git; +Cc: Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
builtin-apply.c | 6 +++---
builtin-push.c | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index 4f0eef0..5991737 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1907,13 +1907,13 @@ static int check_patch(struct patch *pat
static int check_patch_list(struct patch *patch)
{
struct patch *prev_patch = NULL;
- int error = 0;
+ int err = 0;
for (prev_patch = NULL; patch ; patch = patch->next) {
- error |= check_patch(patch, prev_patch);
+ err |= check_patch(patch, prev_patch);
prev_patch = patch;
}
- return error;
+ return err;
}
static void show_index_list(struct patch *list)
diff --git a/builtin-push.c b/builtin-push.c
index 2b5e6fa..ada8338 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -232,7 +232,7 @@ static int do_push(const char *repo)
common_argc = argc;
for (i = 0; i < n; i++) {
- int error;
+ int err;
int dest_argc = common_argc;
int dest_refspec_nr = refspec_nr;
const char **dest_refspec = refspec;
@@ -248,10 +248,10 @@ static int do_push(const char *repo)
while (dest_refspec_nr--)
argv[dest_argc++] = *dest_refspec++;
argv[dest_argc] = NULL;
- error = run_command_v(argc, argv);
- if (!error)
+ err = run_command_v(argc, argv);
+ if (!err)
continue;
- switch (error) {
+ switch (err) {
case -ERR_RUN_COMMAND_FORK:
die("unable to fork for %s", sender);
case -ERR_RUN_COMMAND_EXEC:
@@ -262,7 +262,7 @@ static int do_push(const char *repo)
case -ERR_RUN_COMMAND_WAITPID_NOEXIT:
die("%s died with strange error", sender);
default:
- return -error;
+ return -err;
}
}
return 0;
--
1.4.1.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/7] git_dir holds pointers to local strings, hence MUST be const.
2006-08-23 10:39 [PATCH 1/7] avoid to use error that shadows the function name, use err instead Pierre Habouzit
@ 2006-08-23 10:39 ` Pierre Habouzit
2006-08-23 10:39 ` [PATCH 3/7] missing 'static' keywords Pierre Habouzit
0 siblings, 1 reply; 7+ messages in thread
From: Pierre Habouzit @ 2006-08-23 10:39 UTC (permalink / raw)
To: git; +Cc: Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
cache.h | 2 +-
environment.c | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/cache.h b/cache.h
index 08d6a91..3044794 100644
--- a/cache.h
+++ b/cache.h
@@ -123,7 +123,7 @@ #define DB_ENVIRONMENT "GIT_OBJECT_DIREC
#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
#define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
-extern char *get_git_dir(void);
+extern const char *get_git_dir(void);
extern char *get_object_directory(void);
extern char *get_refs_directory(void);
extern char *get_index_file(void);
diff --git a/environment.c b/environment.c
index e6bd003..5fae9ac 100644
--- a/environment.c
+++ b/environment.c
@@ -25,8 +25,9 @@ int zlib_compression_level = Z_DEFAULT_C
int pager_in_use;
int pager_use_color = 1;
-static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
- *git_graft_file;
+static const char *git_dir;
+static char *git_object_dir, *git_index_file, *git_refs_dir, *git_graft_file;
+
static void setup_git_env(void)
{
git_dir = getenv(GIT_DIR_ENVIRONMENT);
@@ -49,7 +50,7 @@ static void setup_git_env(void)
git_graft_file = strdup(git_path("info/grafts"));
}
-char *get_git_dir(void)
+const char *get_git_dir(void)
{
if (!git_dir)
setup_git_env();
--
1.4.1.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/7] missing 'static' keywords
2006-08-23 10:39 ` [PATCH 2/7] git_dir holds pointers to local strings, hence MUST be const Pierre Habouzit
@ 2006-08-23 10:39 ` Pierre Habouzit
2006-08-23 10:39 ` [PATCH 4/7] remove ugly shadowing of loop indexes in subloops Pierre Habouzit
0 siblings, 1 reply; 7+ messages in thread
From: Pierre Habouzit @ 2006-08-23 10:39 UTC (permalink / raw)
To: git; +Cc: Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
builtin-tar-tree.c | 2 +-
http-push.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index e0bcb0a..61a4135 100644
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
@@ -275,7 +275,7 @@ static void traverse_tree(struct tree_de
}
}
-int git_tar_config(const char *var, const char *value)
+static int git_tar_config(const char *var, const char *value)
{
if (!strcmp(var, "tar.umask")) {
if (!strcmp(value, "user")) {
diff --git a/http-push.c b/http-push.c
index 4849779..7d12f69 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1700,7 +1700,7 @@ static int locking_available(void)
return lock_flags;
}
-struct object_list **add_one_object(struct object *obj, struct object_list **p)
+static struct object_list **add_one_object(struct object *obj, struct object_list **p)
{
struct object_list *entry = xmalloc(sizeof(struct object_list));
entry->item = obj;
--
1.4.1.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/7] remove ugly shadowing of loop indexes in subloops.
2006-08-23 10:39 ` [PATCH 3/7] missing 'static' keywords Pierre Habouzit
@ 2006-08-23 10:39 ` Pierre Habouzit
2006-08-23 10:39 ` [PATCH 5/7] missing #define DEBUG 0 that made the preprocessor whine Pierre Habouzit
0 siblings, 1 reply; 7+ messages in thread
From: Pierre Habouzit @ 2006-08-23 10:39 UTC (permalink / raw)
To: git; +Cc: Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
builtin-mv.c | 6 +++---
git.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin-mv.c b/builtin-mv.c
index ff882be..fd1e520 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -262,10 +262,10 @@ int cmd_mv(int argc, const char **argv,
} else {
for (i = 0; i < changed.nr; i++) {
const char *path = changed.items[i].path;
- int i = cache_name_pos(path, strlen(path));
- struct cache_entry *ce = active_cache[i];
+ int j = cache_name_pos(path, strlen(path));
+ struct cache_entry *ce = active_cache[j];
- if (i < 0)
+ if (j < 0)
die ("Huh? Cache entry for %s unknown?", path);
refresh_cache_entry(ce, 0);
}
diff --git a/git.c b/git.c
index 930998b..a01d195 100644
--- a/git.c
+++ b/git.c
@@ -292,11 +292,11 @@ static void handle_internal_command(int
if (p->option & USE_PAGER)
setup_pager();
if (getenv("GIT_TRACE")) {
- int i;
+ int j;
fprintf(stderr, "trace: built-in: git");
- for (i = 0; i < argc; ++i) {
+ for (j = 0; j < argc; ++j) {
fputc(' ', stderr);
- sq_quote_print(stderr, argv[i]);
+ sq_quote_print(stderr, argv[j]);
}
putc('\n', stderr);
fflush(stderr);
--
1.4.1.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/7] missing #define DEBUG 0 that made the preprocessor whine
2006-08-23 10:39 ` [PATCH 4/7] remove ugly shadowing of loop indexes in subloops Pierre Habouzit
@ 2006-08-23 10:39 ` Pierre Habouzit
2006-08-23 10:39 ` [PATCH 6/7] use name[len] in switch directly, instead of creating a shadowed variable Pierre Habouzit
0 siblings, 1 reply; 7+ messages in thread
From: Pierre Habouzit @ 2006-08-23 10:39 UTC (permalink / raw)
To: git; +Cc: Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
builtin-grep.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-grep.c b/builtin-grep.c
index 0bd517b..3123494 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -14,6 +14,8 @@ #include <regex.h>
#include <fnmatch.h>
#include <sys/wait.h>
+#define DEBUG 0
+
/*
* git grep pathspecs are somewhat different from diff-tree pathspecs;
* pathname wildcards are allowed.
--
1.4.1.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/7] use name[len] in switch directly, instead of creating a shadowed variable.
2006-08-23 10:39 ` [PATCH 5/7] missing #define DEBUG 0 that made the preprocessor whine Pierre Habouzit
@ 2006-08-23 10:39 ` Pierre Habouzit
2006-08-23 10:39 ` [PATCH 7/7] n is in fact unused, and is later shadowed Pierre Habouzit
0 siblings, 1 reply; 7+ messages in thread
From: Pierre Habouzit @ 2006-08-23 10:39 UTC (permalink / raw)
To: git; +Cc: Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
builtin-apply.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index 5991737..f8f5eeb 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -606,9 +606,7 @@ static char *git_header_name(char *line,
* form.
*/
for (len = 0 ; ; len++) {
- char c = name[len];
-
- switch (c) {
+ switch (name[len]) {
default:
continue;
case '\n':
--
1.4.1.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 7/7] n is in fact unused, and is later shadowed.
2006-08-23 10:39 ` [PATCH 6/7] use name[len] in switch directly, instead of creating a shadowed variable Pierre Habouzit
@ 2006-08-23 10:39 ` Pierre Habouzit
0 siblings, 0 replies; 7+ messages in thread
From: Pierre Habouzit @ 2006-08-23 10:39 UTC (permalink / raw)
To: git; +Cc: Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
date.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/date.c b/date.c
index 66be23a..63d1d5b 100644
--- a/date.c
+++ b/date.c
@@ -584,10 +584,9 @@ static const char *approxidate_alpha(con
const struct typelen *tl;
const struct special *s;
const char *end = date;
- int n = 1, i;
+ int i;
- while (isalpha(*++end))
- n++;
+ while (isalpha(*++end));
for (i = 0; i < 12; i++) {
int match = match_string(date, month_names[i]);
--
1.4.1.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-08-23 10:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-23 10:39 [PATCH 1/7] avoid to use error that shadows the function name, use err instead Pierre Habouzit
2006-08-23 10:39 ` [PATCH 2/7] git_dir holds pointers to local strings, hence MUST be const Pierre Habouzit
2006-08-23 10:39 ` [PATCH 3/7] missing 'static' keywords Pierre Habouzit
2006-08-23 10:39 ` [PATCH 4/7] remove ugly shadowing of loop indexes in subloops Pierre Habouzit
2006-08-23 10:39 ` [PATCH 5/7] missing #define DEBUG 0 that made the preprocessor whine Pierre Habouzit
2006-08-23 10:39 ` [PATCH 6/7] use name[len] in switch directly, instead of creating a shadowed variable Pierre Habouzit
2006-08-23 10:39 ` [PATCH 7/7] n is in fact unused, and is later shadowed Pierre Habouzit
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.