git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] make-static: pu

From
Junio C Hamano <junio@pobox.com>
Date
Sep 11, 2011, 21:38 UTC
Message-ID
<7v39g2n4iq.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4E6D0E3F.3090304@ramsay1.demon.co.uk>
Many symbols that are exported to the global scope do not have to be.

This needs to be split into separate patches and squashed into each individual commit that introduces these symbols.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 dir.c            |    2 +-
 dir.h            |    1 -
 metadata-cache.c |    8 ++++----
 metadata-cache.h |    5 -----
 refs.c           |    2 +-
 5 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/dir.c b/dir.c
index fba6433..bee7ed1 100644
--- a/dir.c
+++ b/dir.c
@@ -34,7 +34,7 @@ static int fnmatch_icase(const char *pattern, const char *string, int flags)
 	return fnmatch(pattern, string, flags | (ignore_case ? FNM_CASEFOLD : 0));
 }
 
-size_t common_prefix_len(const char **pathspec)
+static size_t common_prefix_len(const char **pathspec)
 {
 	const char *n, *first;
 	size_t max = 0;
diff --git a/dir.h b/dir.h
index 592ceca..9b7bfd4 100644
--- a/dir.h
+++ b/dir.h
@@ -64,7 +64,6 @@ struct dir_struct {
 #define MATCHED_RECURSIVELY 1
 #define MATCHED_FNMATCH 2
 #define MATCHED_EXACTLY 3
-extern size_t common_prefix_len(const char **pathspec);
 extern char *common_prefix(const char **pathspec);
 extern int match_pathspec(const char **pathspec, const char *name, int namelen, int prefix, char *seen);
 extern int match_pathspec_depth(const struct pathspec *pathspec,
diff --git a/metadata-cache.c b/metadata-cache.c
index 32d3c21..5f5ca4e 100644
--- a/metadata-cache.c
+++ b/metadata-cache.c
@@ -287,8 +287,8 @@ static void *lookup_disk(struct metadata_cache *c,
 	return c->disk_entries + (pos * record_size(c)) + 20;
 }
 
-const void *metadata_cache_lookup(struct metadata_cache *c,
-				  const struct object *obj)
+static const void *metadata_cache_lookup(struct metadata_cache *c,
+					 const struct object *obj)
 {
 	void *r;
 
@@ -300,8 +300,8 @@ const void *metadata_cache_lookup(struct metadata_cache *c,
 	return r;
 }
 
-void metadata_cache_add(struct metadata_cache *c, const struct object *obj,
-			const void *value)
+static void metadata_cache_add(struct metadata_cache *c, const struct object *obj,
+			       const void *value)
 {
 	metadata_cache_init(c);
 	add_decoration_value(&c->mem, obj, value, NULL);
diff --git a/metadata-cache.h b/metadata-cache.h
index 15484b5..4819563 100644
--- a/metadata-cache.h
+++ b/metadata-cache.h
@@ -24,11 +24,6 @@ struct metadata_cache {
 #define METADATA_CACHE_INIT(name, width, validity) \
 	{ validity, { (name), (width) } }
 
-const void *metadata_cache_lookup(struct metadata_cache *,
-				  const struct object *);
-void metadata_cache_add(struct metadata_cache *, const struct object *,
-			const void *value);
-
 /* Convenience wrappers around metadata_cache_{lookup,add} */
 int metadata_cache_lookup_uint32(struct metadata_cache *,
 				 const struct object *,
diff --git a/refs.c b/refs.c
index 1c4aa33..6e9588b 100644
--- a/refs.c
+++ b/refs.c
@@ -185,7 +185,7 @@ static void clear_cached_refs(struct cached_refs *ca)
 	ca->did_loose = ca->did_packed = 0;
 }
 
-struct cached_refs *create_cached_refs(const char *submodule)
+static struct cached_refs *create_cached_refs(const char *submodule)
 {
 	int len;
 	struct cached_refs *refs;
-- 
1.7.7.rc0.188.g3793ac
Previous: Junio C Hamano
Message 14 of 14 in “sparse: Fix some "symbol not declared" warnings”
  1. 1/3 sparse: Fix some "symbol not declared" warningsRamsay Jones, Sep 11, 2011
  2. Junio C HamanoSep 11, 2011
  3. Junio C HamanoSep 12, 2011
  4. 1/3 make-static: masterJunio C Hamano, Sep 11, 2011
  5. Ramkumar RamachandraSep 12, 2011
  6. Junio C HamanoSep 15, 2011
  7. Ramsay JonesSep 13, 2011
  8. Junio C HamanoSep 13, 2011
  9. Johannes SixtSep 14, 2011
  10. Junio C HamanoSep 14, 2011
  11. Junio C HamanoSep 14, 2011
  12. Thomas RastSep 14, 2011
  13. 2/3 make-static: nextJunio C Hamano, Sep 11, 2011
  14. 3/3 make-static: puJunio C Hamano, Sep 11, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.