From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
GIT Mailing-list <git@vger.kernel.org>
Subject: [PATCH] sha1_file.c: Fix a sparse warning
Date: Mon, 11 Feb 2013 19:02:17 +0000 [thread overview]
Message-ID: <51194039.4010407@ramsay1.demon.co.uk> (raw)
Sparse issues an "... was not declared. Should it be static?" warning
against the 'report_pack_garbage' symbol. In order to suppress the
warning, since this symbol requires more than file scope, we add an
extern declaration to the cache.h header file (and remove the now
redundant extern declaration in builtin/count-objects.c).
[As an alternative solution, make the variable a (static) file scope
variable and add an extern function set_report_pack_garbage(), which
would take a function pointer, to set the local variable ... etc.]
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
Hi Nguyen,
If you need to re-roll your 'nd/count-garbage' patches, could you
please squash this (or something like it) into commit c2071d7a
("count-objects: report garbage files in pack directory too",
08-02-2013).
Thanks!
[BTW, I have an unsettling feeling that the above salutation should
read "Hi Duy," and I'm being (unintentionally) offensive. If so,
please let me know and accept my apologies. ;-) ]
ATB,
Ramsay Jones
builtin/count-objects.c | 1 -
cache.h | 3 +++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index 118b2ae..605c215 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -11,7 +11,6 @@
static unsigned long garbage;
-extern void (*report_pack_garbage)(const char *path, int len, const char *name);
static void real_report_pack_garbage(const char *path, int len, const char *name)
{
if (len && name)
diff --git a/cache.h b/cache.h
index 6818d87..0d687b4 100644
--- a/cache.h
+++ b/cache.h
@@ -779,6 +779,9 @@ extern int has_pack_index(const unsigned char *sha1);
extern void assert_sha1_type(const unsigned char *sha1, enum object_type expect);
+/* A hook for count-objects to report invalid files in pack directory */
+extern void (*report_pack_garbage)(const char *path, int len, const char *name);
+
extern const signed char hexval_table[256];
static inline unsigned int hexval(unsigned char c)
{
--
1.8.1
reply other threads:[~2013-02-11 19:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51194039.4010407@ramsay1.demon.co.uk \
--to=ramsay@ramsay1.demon.co.uk \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).