Skip to contentSkip to conversation

sha1_file.c: make parse_sha1_header_extended() static

PATCH In review Ramsay Jones 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sha1_file.c: make parse_sha1_header_extended() static

commit 9e1f5bc0 ("sha1_file.c: support reading from a loose object of unknown type", 15-04-2015) added a new externally visible function which does not require more than file scope. This causes sparse to issue a warning message about this symbol. In order to suppress the warning, add the static qualifier to the function definition.

[An alternative solution, if this symbol should have external scope, is to add an external declaration for the function to the "cache.h" header file (next to the one for parse_sha1_header()).]

---

Hi Karthik,

If you need to re-roll your patches in the 'kn/cat-file-literally' branch, could you please squash this, or something like it, into the relevant patch.

Thanks!

ATB,
Ramsay Jones

 sha1_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sha1_file.c +1 -1
index 267399d..2b81534 100644
@@ -1642,7 +1642,7 @@ static void *unpack_sha1_rest(git_zstream *stream, void *buffer, unsigned long s
  * too permissive for what we want to check. So do an anal
  * object header parse by hand.
  */
-int parse_sha1_header_extended(const char *hdr, struct object_info *oi,
+static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,
 			       unsigned int flags)
 {
 	struct strbuf typename = STRBUF_INIT;
Signature · 1 line
2.3.0
#1 lore raw
Quoted 11 lines · Ramsay Jones

commit 9e1f5bc0 ("sha1_file.c: support reading from a loose object of unknown type", 15-04-2015) added a new externally visible function which does not require more than file scope. This causes sparse to issue a warning message about this symbol. In order to suppress the warning, add the static qualifier to the function definition.

[An alternative solution, if this symbol should have external scope, is to add an external declaration for the function to the "cache.h" header file (next to the one for parse_sha1_header()).]

Quoted 8 lines

---

Hi Karthik,

If you need to re-roll your patches in the 'kn/cat-file-literally' branch, could you please squash this, or something like it, into the relevant patch.

Thanks for this Ramsay, will be re rolling, will squash it into my commit.

Regards
Karthik

Quoted 27 lines

Thanks!

ATB,
Ramsay Jones

sha1_file.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
sha1_file.c +1 -1
index 267399d..2b81534 100644
@@ -1642,7 +1642,7 @@ static void *unpack_sha1_rest(git_zstream
 *stream, void *buffer, unsigned long s
 * too permissive for what we want to check. So do an anal
 * object header parse by hand.
 */
-int parse_sha1_header_extended(const char *hdr, struct object_info
 *oi,
+static int parse_sha1_header_extended(const char *hdr, struct
 object_info *oi,

unsigned int flags)

{
	struct strbuf typename = STRBUF_INIT;
Signature · 1 line
2.3.0
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.