summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 08c8d55)
raw | patch | inline | side by side (parent: 08c8d55)
author | Stephen Boyd <bebarino@gmail.com> | |
Tue, 22 Mar 2011 07:51:05 +0000 (00:51 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 22 Mar 2011 17:16:54 +0000 (10:16 -0700) |
Fix warnings from 'make check'.
- These files don't include 'builtin.h' causing sparse to complain that
cmd_* isn't declared:
builtin/clone.c:364, builtin/fetch-pack.c:797,
builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
builtin/merge-index.c:69, builtin/merge-recursive.c:22
builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
builtin/notes.c:822, builtin/pack-redundant.c:596,
builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
builtin/remote.c:1512, builtin/remote-ext.c:240,
builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
builtin/unpack-file.c:25, builtin/var.c:75
- These files have symbols which should be marked static since they're
only file scope:
submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48
- These files redeclare symbols to be different types:
builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
usage.c:49, usage.c:58, usage.c:63, usage.c:72
- These files use a literal integer 0 when they really should use a NULL
pointer:
daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362
While we're in the area, clean up some unused #includes in builtin files
(mostly exec_cmd.h).
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
- These files don't include 'builtin.h' causing sparse to complain that
cmd_* isn't declared:
builtin/clone.c:364, builtin/fetch-pack.c:797,
builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
builtin/merge-index.c:69, builtin/merge-recursive.c:22
builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
builtin/notes.c:822, builtin/pack-redundant.c:596,
builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
builtin/remote.c:1512, builtin/remote-ext.c:240,
builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
builtin/unpack-file.c:25, builtin/var.c:75
- These files have symbols which should be marked static since they're
only file scope:
submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48
- These files redeclare symbols to be different types:
builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
usage.c:49, usage.c:58, usage.c:63, usage.c:72
- These files use a literal integer 0 when they really should use a NULL
pointer:
daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362
While we're in the area, clean up some unused #includes in builtin files
(mostly exec_cmd.h).
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
35 files changed:
diff --git a/builtin/clone.c b/builtin/clone.c
index 02547adba5d841c066ed7e9c93247b509b2b9c44..c6e10bb9e916a21ad5c71018d6380ad85540dc65 100644 (file)
--- a/builtin/clone.c
+++ b/builtin/clone.c
* Clone a repository into a different directory that does not yet exist.
*/
-#include "cache.h"
+#include "builtin.h"
#include "parse-options.h"
#include "fetch-pack.h"
#include "refs.h"
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 272bc383d6de5c19970f7c65b924551d9b76598a..ef398620affcb55aa1ee0fdd3ca74dda58c37172 100644 (file)
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
-#include "cache.h"
+#include "builtin.h"
#include "refs.h"
#include "pkt-line.h"
#include "commit.h"
index 5189b16c9e59c20b449435c413c34da9f7bf9baa..75816329d6153c35e0763b35f70cfaf165f2a4b8 100644 (file)
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
int head_status;
};
-void init_src_data(struct src_data *data)
+static void init_src_data(struct src_data *data)
{
data->branch.strdup_strings = 1;
data->tag.strdup_strings = 1;
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index c90acddcb2c32ce5170a220c9b1af96b44552a41..b96f46acf52d23f68c1ec164be8264396dea22db 100644 (file)
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
* Copyright (C) Linus Torvalds, 2005
* Copyright (C) Junio C Hamano, 2005
*/
-#include "cache.h"
+#include "builtin.h"
#include "blob.h"
#include "quote.h"
#include "parse-options.h"
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index c7e600db4745c80fddcb14986bc192d80630aa51..5a67c8181e5273ab0e79b8cb704dadc87cde1a37 100644 (file)
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
static NORETURN void bad_object(unsigned long offset, const char *format,
...) __attribute__((format (printf, 2, 3)));
-static void bad_object(unsigned long offset, const char *format, ...)
+static NORETURN void bad_object(unsigned long offset, const char *format, ...)
{
va_list params;
char buf[1024];
diff --git a/builtin/merge-index.c b/builtin/merge-index.c
index 2c4cf5e559b4166973f12bda567e1a6c5657a7e7..23388325879c5a52a4a8c25f254aafe23573e820 100644 (file)
--- a/builtin/merge-index.c
+++ b/builtin/merge-index.c
-#include "cache.h"
+#include "builtin.h"
#include "run-command.h"
-#include "exec_cmd.h"
static const char *pgm;
static int one_shot, quiet;
index c33091b3ed52bc8539ff82f039ec8c7718f3dcc2..3a64f5d0bdbcc8d7d21edb01f285cc8b41755228 100644 (file)
-#include "cache.h"
+#include "builtin.h"
#include "commit.h"
#include "tag.h"
#include "merge-recursive.h"
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 9b25ddc9794efe489ee9ec9fd3203ffa997f03f7..19917426fba19cf60b838ff9b07d20b5e44259a5 100644 (file)
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
-#include "cache.h"
+#include "builtin.h"
#include "tree-walk.h"
#include "xdiff-interface.h"
#include "blob.h"
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 1cb0f3f2a7cf580efc76957de24684630d596af9..d0ccbb22227ac9667ded5fc5687ca64b7fd66afc 100644 (file)
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
-#include "cache.h"
+#include "builtin.h"
#include "tag.h"
-#include "exec_cmd.h"
/*
* A signature file has a very simple fixed format: four lines
diff --git a/builtin/notes.c b/builtin/notes.c
index 0aab150c52c839512b82b5efc6e978b7a80653e3..a0f310b72956dcb00d2a0899d39ddfb9f7811fa4 100644 (file)
--- a/builtin/notes.c
+++ b/builtin/notes.c
free(c);
}
-int notes_copy_from_stdin(int force, const char *rewrite_cmd)
+static int notes_copy_from_stdin(int force, const char *rewrite_cmd)
{
struct strbuf buf = STRBUF_INIT;
struct notes_rewrite_cfg *c = NULL;
t = xcalloc(1, sizeof(struct notes_tree));
init_notes(t, "NOTES_MERGE_PARTIAL", combine_notes_overwrite, 0);
- o->local_ref = resolve_ref("NOTES_MERGE_REF", sha1, 0, 0);
+ o->local_ref = resolve_ref("NOTES_MERGE_REF", sha1, 0, NULL);
if (!o->local_ref)
die("Failed to resolve NOTES_MERGE_REF");
index 41e1615a28d772d1677c172ff2f570f31de4026f..f5c6afc5dd46c8f856d0f125287724bbfdc65db7 100644 (file)
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
*
*/
-#include "cache.h"
-#include "exec_cmd.h"
+#include "builtin.h"
#define BLKSIZE 512
diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c
index 091860b2e370561f0811399b0d307e732e9eaac3..39a9d89fbdf322a8ef42a62e41ac36af934ff638 100644 (file)
--- a/builtin/pack-refs.c
+++ b/builtin/pack-refs.c
-#include "cache.h"
+#include "builtin.h"
#include "parse-options.h"
#include "pack-refs.h"
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index 49a0472a9bd28274c4be1352996e700a1db4b94a..f821eb3f0b864c26d5e822cc7c5b0747340abee5 100644 (file)
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
-#include "cache.h"
-#include "exec_cmd.h"
+#include "builtin.h"
static void flush_current_id(int patchlen, unsigned char *id, git_SHA_CTX *c)
{
return 1;
}
-int get_one_patchid(unsigned char *next_sha1, git_SHA_CTX *ctx)
+static int get_one_patchid(unsigned char *next_sha1, git_SHA_CTX *ctx)
{
static char line[1000];
int patchlen = 0, found_next = 0;
diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c
index ea71977c8360e1a7899bbd035cf26f93d889800b..155e609d68ae81a94128d8d6588dc54463c36ef2 100644 (file)
--- a/builtin/remote-ext.c
+++ b/builtin/remote-ext.c
-#include "git-compat-util.h"
+#include "builtin.h"
#include "transport.h"
#include "run-command.h"
diff --git a/builtin/remote-fd.c b/builtin/remote-fd.c
index 1f2467bdb756435764f9156ffefeeb510dc872d8..08d7121b6d118042a45086d2902769d282c062f8 100644 (file)
--- a/builtin/remote-fd.c
+++ b/builtin/remote-fd.c
-#include "git-compat-util.h"
+#include "builtin.h"
#include "transport.h"
/*
diff --git a/builtin/remote.c b/builtin/remote.c
index cb26080956077f8c9ae02c91ffdc341293a4f9f1..b71ecd228f5c27bc436602469d3090eb860a1222 100644 (file)
--- a/builtin/remote.c
+++ b/builtin/remote.c
-#include "cache.h"
+#include "builtin.h"
#include "parse-options.h"
#include "transport.h"
#include "remote.h"
diff --git a/builtin/reset.c b/builtin/reset.c
index 5de2bceeec8c1d243ed6da70464d0c4dd60d7352..eb5f98c16320cd4eded3c842ec1d019e75c5b9c3 100644 (file)
--- a/builtin/reset.c
+++ b/builtin/reset.c
*
* Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano
*/
-#include "cache.h"
+#include "builtin.h"
#include "tag.h"
#include "object.h"
#include "commit.h"
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 2cd1c40b70890732905ad9433e452aa9a9548533..8b0911c0d2ac5a60f8a3c7a43e7960617ded9d7a 100644 (file)
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
-#include "cache.h"
+#include "builtin.h"
#include "commit.h"
#include "refs.h"
#include "pkt-line.h"
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index 608590ada8105a2e6a8cb9d6176696b511b410f6..19200291a2632554223b1a675d5324b4682248ab 100644 (file)
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
-#include "cache.h"
-#include "blob.h"
-#include "exec_cmd.h"
+#include "builtin.h"
static char *create_temp_file(unsigned char *sha1)
{
diff --git a/builtin/var.c b/builtin/var.c
index 0744bb83185289e26bd32b3b2ecaec717d8c75d7..99d068a5327255f36c8e415ecb8d0cf98cbbe180 100644 (file)
--- a/builtin/var.c
+++ b/builtin/var.c
*
* Copyright (C) Eric Biederman, 2005
*/
-#include "cache.h"
-#include "exec_cmd.h"
+#include "builtin.h"
static const char var_usage[] = "git var (-l | <variable>)";
diff --git a/daemon.c b/daemon.c
index 347fd0c52b4cd797f5dafffb6885324f7c7f0274..4c8346d5a1fe1325de2dd335a4e61a2dad994211 100644 (file)
--- a/daemon.c
+++ b/daemon.c
static char **cld_argv;
static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
{
- struct child_process cld = { 0 };
+ struct child_process cld = { NULL };
char addrbuf[300] = "REMOTE_ADDR=", portbuf[300];
char *env[] = { addrbuf, portbuf, NULL };
index 42a107c58ae6f81ffe514e573afdaec881c4532e..9b3eb9938f8cf9f81cac2b9e79da34e1e02e727c 100644 (file)
--- a/diff.c
+++ b/diff.c
const char *newline;
};
-struct diff_words_style diff_words_styles[] = {
+static struct diff_words_style diff_words_styles[] = {
{ DIFF_WORDS_PORCELAIN, {"+", "\n"}, {"-", "\n"}, {" ", "\n"}, "~\n" },
{ DIFF_WORDS_PLAIN, {"{+", "+}"}, {"[-", "-]"}, {"", ""}, "\n" },
{ DIFF_WORDS_COLOR, {"", ""}, {"", ""}, {"", ""}, "\n" }
diff --git a/fast-import.c b/fast-import.c
index d9f9a3f524671877d01d0897141a753f8b9c766a..65d65bf8f91b7a584c7dc77f84a5dec263c3d11c 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
{
const char *p;
struct tree_entry *root = NULL;
- struct tree_entry leaf = {0};
+ struct tree_entry leaf = {NULL};
/* ls SP (<treeish> SP)? <path> */
p = command_buf.buf + strlen("ls ");
diff --git a/imap-send.c b/imap-send.c
index 71506a8dd3ed07fe44c487a644ce9a42b94a7578..9adf4b981953080676aa24907fead1038b920e60 100644 (file)
--- a/imap-send.c
+++ b/imap-send.c
if (srvc->tunnel) {
const char *argv[] = { srvc->tunnel, NULL };
- struct child_process tunnel = {0};
+ struct child_process tunnel = {NULL};
imap_info("Starting tunnel '%s'... ", srvc->tunnel);
diff --git a/notes-merge.c b/notes-merge.c
index 1467ad31795ae21896f1e608e7cb032df2bc94a8..28046a998426e88dec9ad6ab431624bb41a81ce1 100644 (file)
--- a/notes-merge.c
+++ b/notes-merge.c
read_mmblob(&remote, p->remote);
status = ll_merge(&result_buf, sha1_to_hex(p->obj), &base, NULL,
- &local, o->local_ref, &remote, o->remote_ref, 0);
+ &local, o->local_ref, &remote, o->remote_ref, NULL);
free(base.ptr);
free(local.ptr);
diff --git a/parse-options.c b/parse-options.c
index 42b51ef14514f3c3df454e4b718718a9b58f1612..73bd28ad90986af1618d82176076133186d045de 100644 (file)
--- a/parse-options.c
+++ b/parse-options.c
return PARSE_OPT_HELP;
}
-void usage_with_options(const char * const *usagestr,
+void NORETURN usage_with_options(const char * const *usagestr,
const struct option *opts)
{
usage_with_options_internal(NULL, usagestr, opts, 0, 1);
exit(129);
}
-void usage_msg_opt(const char *msg,
+void NORETURN usage_msg_opt(const char *msg,
const char * const *usagestr,
const struct option *options)
{
diff --git a/replace_object.c b/replace_object.c
index eb59604fd39e2beaf7d43802499c27305ac92132..7c6c7544ada4585e62341f0c0854a919f10c2277 100644 (file)
--- a/replace_object.c
+++ b/replace_object.c
#include "cache.h"
#include "sha1-lookup.h"
#include "refs.h"
+#include "commit.h"
static struct replace_object {
unsigned char sha1[2][20];
diff --git a/submodule.c b/submodule.c
index e9f2b19e1c867b870b0b5f3ef3db3c871fe20689..0cb6d1829944b8a6d0f1a7ed1c228b61c31c7e0d 100644 (file)
--- a/submodule.c
+++ b/submodule.c
#include "refs.h"
#include "string-list.h"
-struct string_list config_name_for_path;
-struct string_list config_fetch_recurse_submodules_for_name;
-struct string_list config_ignore_for_name;
+static struct string_list config_name_for_path;
+static struct string_list config_fetch_recurse_submodules_for_name;
+static struct string_list config_ignore_for_name;
static int config_fetch_recurse_submodules;
static int add_submodule_odb(const char *path)
diff --git a/thread-utils.c b/thread-utils.c
index 589f838f82b568195232ea81346d0049261b86b1..7f4b76a95899cc28aa1d42598d1649f126980ed9 100644 (file)
--- a/thread-utils.c
+++ b/thread-utils.c
#include "cache.h"
-#include <pthread.h>
+#include "thread-utils.h"
#if defined(hpux) || defined(__hpux) || defined(_hpux)
# include <sys/pstat.h>
index 8390bf7cbb82e8f1e9e6f7229516e43f288d6e41..d95341693fa9b27caed38ffe1308838bedb49f83 100644 (file)
--- a/trace.c
+++ b/trace.c
strbuf_release(&buf);
}
-void trace_printf_key(const char *key, const char *fmt, ...)
+static void trace_printf_key(const char *key, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
diff --git a/transport-helper.c b/transport-helper.c
index 0c5b1bd994d79cd6441a5c956a2d851b6bea7d5f..5846b55875f6e568711b2f90726bb6608aaf4e73 100644 (file)
--- a/transport-helper.c
+++ b/transport-helper.c
die_errno("Full write to remote helper failed");
}
-const char *remove_ext_force(const char *url)
+static const char *remove_ext_force(const char *url)
{
if (url) {
const char *colon = strchr(url, ':');
diff --git a/transport.c b/transport.c
index 00786606117feea4b33b7e632b8ff8a3c26de4e4..f1c07816e01bb0b1ad93d7665b1374e8cd36e6cb 100644 (file)
--- a/transport.c
+++ b/transport.c
static struct ref *get_refs_via_rsync(struct transport *transport, int for_push)
{
struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;
- struct ref dummy = {0}, *tail = &dummy;
+ struct ref dummy = {NULL}, *tail = &dummy;
struct child_process rsync;
const char *args[5];
int temp_dir_len;
diff --git a/unpack-trees.c b/unpack-trees.c
index b68ec820dde935eb2578a8983c265290d0511add..500ebcfd545772fb17e5fb14bba42bf4be468b75 100644 (file)
--- a/unpack-trees.c
+++ b/unpack-trees.c
* situation better. See how "git checkout" and "git merge" replaces
* them using setup_unpack_trees_porcelain(), for example.
*/
-const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
+static const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
/* ERROR_WOULD_OVERWRITE */
"Entry '%s' would be overwritten by merge. Cannot merge.",
index 6a5495960f03ded65f0f5f8b8bd5c7cd98c0b05e..3e06fd34c46a00b41f4843ea87a151314ce0789c 100644 (file)
--- a/url.c
+++ b/url.c
#include "cache.h"
+#include "url.h"
int is_urlschemechar(int first_flag, int ch)
{
index ec4cf53b6bf16f7f9b3528a430891d6c68ef64cc..b5e67e3d0d4a46a69d72371f4c6a0002e40a0bf1 100644 (file)
--- a/usage.c
+++ b/usage.c
die_routine = routine;
}
-void usagef(const char *err, ...)
+void NORETURN usagef(const char *err, ...)
{
va_list params;
va_end(params);
}
-void usage(const char *err)
+void NORETURN usage(const char *err)
{
usagef("%s", err);
}
-void die(const char *err, ...)
+void NORETURN die(const char *err, ...)
{
va_list params;
va_end(params);
}
-void die_errno(const char *fmt, ...)
+void NORETURN die_errno(const char *fmt, ...)
{
va_list params;
char fmt_with_err[1024];