{"thread":{"id":"2620","subject":"[PATCH] Fix sparse warnings","startedAt":"2005-11-21T00:52:52Z","lastAt":"2005-11-21T00:52:52Z","messageCount":1,"participants":["Timo Hirvonen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"12405","messageId":"20051121025252.6c2249c3.tihirvon@gmail.com","threadId":"2620","inReplyTo":null,"subject":"[PATCH] Fix sparse warnings","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2005-11-21T00:52:52Z","receivedAt":"2005-11-21T00:52:52Z","isPatch":true,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"\nMake some functions static and convert func() function prototypes to to\nfunc(void).  Fix declaration after statement, missing declaration and\nredundant declaration warnings.\n\nSigned-off-by: Timo Hirvonen <tihirvon@gmail.com>\n\n---\n\n cache.h          |    1 +\n name-rev.c       |    2 --\n pack-redundant.c |   58 +++++++++++++++++++++++++++---------------------------\n path.c           |    2 +-\n 4 files changed, 31 insertions(+), 32 deletions(-)\n\napplies-to: e12ceef6841365e64bb765294235a67e9263d7de\nb29cab489ba0dbd6daf69b491978615a1a96f781\ndiff --git a/cache.h b/cache.h\nindex a7c1bbd..c7c6637 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -203,6 +203,7 @@ int git_mkstemp(char *path, size_t n, co\n \n int safe_create_leading_directories(char *path);\n char *safe_strncpy(char *, const char *, size_t);\n+char *enter_repo(char *path, int strict);\n \n /* Read and unpack a sha1 file into memory, write memory to a sha1 file */\n extern int unpack_sha1_header(z_stream *stream, void *map, unsigned long mapsize, void *buffer, unsigned long size);\ndiff --git a/name-rev.c b/name-rev.c\nindex 59194f1..817e36b 100644\n--- a/name-rev.c\n+++ b/name-rev.c\n@@ -230,8 +230,6 @@ int main(int argc, char **argv)\n \t\t\t\tfwrite(p_start, p - p_start, 1, stdout);\n \t\t}\n \t} else if (all) {\n-\t\textern struct object **objs;\n-\t\textern int nr_objs;\n \t\tint i;\n \n \t\tfor (i = 0; i < nr_objs; i++)\ndiff --git a/pack-redundant.c b/pack-redundant.c\nindex fb6cb48..1519385 100644\n--- a/pack-redundant.c\n+++ b/pack-redundant.c\n@@ -11,19 +11,19 @@\n static const char pack_redundant_usage[] =\n \"git-pack-redundant [ --verbose ] [ --alt-odb ] < --all | <.pack filename> ...>\";\n \n-int load_all_packs = 0, verbose = 0, alt_odb = 0;\n+static int load_all_packs = 0, verbose = 0, alt_odb = 0;\n \n struct llist_item {\n \tstruct llist_item *next;\n \tchar *sha1;\n };\n-struct llist {\n+static struct llist {\n \tstruct llist_item *front;\n \tstruct llist_item *back;\n \tsize_t size;\n } *all_objects; /* all objects which must be present in local packfiles */\n \n-struct pack_list {\n+static struct pack_list {\n \tstruct pack_list *next;\n \tstruct packed_git *pack;\n \tstruct llist *unique_objects;\n@@ -36,7 +36,7 @@ struct pll {\n \tsize_t pl_size;\n };\n \n-inline void llist_free(struct llist *list)\n+static inline void llist_free(struct llist *list)\n {\n \twhile((list->back = list->front)) {\n \t\tlist->front = list->front->next;\n@@ -45,14 +45,14 @@ inline void llist_free(struct llist *lis\n \tfree(list);\n }\n \n-inline void llist_init(struct llist **list)\n+static inline void llist_init(struct llist **list)\n {\n \t*list = xmalloc(sizeof(struct llist));\n \t(*list)->front = (*list)->back = NULL;\n \t(*list)->size = 0;\n }\n \n-struct llist * llist_copy(struct llist *list)\n+static struct llist * llist_copy(struct llist *list)\n {\n \tstruct llist *ret;\n \tstruct llist_item *new, *old, *prev;\n@@ -79,7 +79,7 @@ struct llist * llist_copy(struct llist *\n \treturn ret;\n }\n \n-inline struct llist_item * llist_insert(struct llist *list,\n+static inline struct llist_item * llist_insert(struct llist *list,\n \t\t\t\t\tstruct llist_item *after, char *sha1)\n {\n \tstruct llist_item *new = xmalloc(sizeof(struct llist_item));\n@@ -102,12 +102,12 @@ inline struct llist_item * llist_insert(\n \treturn new;\n }\n \n-inline struct llist_item * llist_insert_back(struct llist *list, char *sha1)\n+static inline struct llist_item * llist_insert_back(struct llist *list, char *sha1)\n {\n \treturn llist_insert(list, list->back, sha1);\n }\n \n-inline struct llist_item * llist_insert_sorted_unique(struct llist *list,\n+static inline struct llist_item * llist_insert_sorted_unique(struct llist *list,\n \t\t\t\t\tchar *sha1, struct llist_item *hint)\n {\n \tstruct llist_item *prev = NULL, *l;\n@@ -129,7 +129,7 @@ inline struct llist_item * llist_insert_\n }\n \n /* returns a pointer to an item in front of sha1 */\n-inline struct llist_item * llist_sorted_remove(struct llist *list, char *sha1,\n+static inline struct llist_item * llist_sorted_remove(struct llist *list, char *sha1,\n \t\t\t\t\t       struct llist_item *hint)\n {\n \tstruct llist_item *prev, *l;\n@@ -164,7 +164,7 @@ redo_from_start:\n }\n \n /* computes A\\B */\n-void llist_sorted_difference_inplace(struct llist *A,\n+static void llist_sorted_difference_inplace(struct llist *A,\n \t\t\t\t     struct llist *B)\n {\n \tstruct llist_item *hint, *b;\n@@ -178,7 +178,7 @@ void llist_sorted_difference_inplace(str\n \t}\n }\n \n-inline struct pack_list * pack_list_insert(struct pack_list **pl,\n+static inline struct pack_list * pack_list_insert(struct pack_list **pl,\n \t\t\t\t\t   struct pack_list *entry)\n {\n \tstruct pack_list *p = xmalloc(sizeof(struct pack_list));\n@@ -188,7 +188,7 @@ inline struct pack_list * pack_list_inse\n \treturn p;\n }\n \n-inline size_t pack_list_size(struct pack_list *pl)\n+static inline size_t pack_list_size(struct pack_list *pl)\n {\n \tsize_t ret = 0;\n \twhile(pl) {\n@@ -198,7 +198,7 @@ inline size_t pack_list_size(struct pack\n \treturn ret;\n }\n \n-struct pack_list * pack_list_difference(struct pack_list *A,\n+static struct pack_list * pack_list_difference(struct pack_list *A,\n \t\t\t\t\tstruct pack_list *B)\n {\n \tstruct pack_list *ret, *pl;\n@@ -218,7 +218,7 @@ struct pack_list * pack_list_difference(\n \treturn ret;\n }\n \n-void cmp_two_packs(struct pack_list *p1, struct pack_list *p2)\n+static void cmp_two_packs(struct pack_list *p1, struct pack_list *p2)\n {\n \tint p1_off, p2_off;\n \tvoid *p1_base, *p2_base;\n@@ -250,7 +250,7 @@ void cmp_two_packs(struct pack_list *p1,\n \t}\n }\n \n-void pll_insert(struct pll **pll, struct pll **hint_table)\n+static void pll_insert(struct pll **pll, struct pll **hint_table)\n {\n \tstruct pll *prev;\n \tint i = (*pll)->pl_size - 1;\n@@ -276,7 +276,7 @@ void pll_insert(struct pll **pll, struct\n /* all the permutations have to be free()d at the same time,\n  * since they refer to each other\n  */\n-struct pll * get_all_permutations(struct pack_list *list)\n+static struct pll * get_all_permutations(struct pack_list *list)\n {\n \tstruct pll *subset, *pll, *new_pll = NULL; /*silence warning*/\n \tstatic struct pll **hint = NULL;\n@@ -323,7 +323,7 @@ struct pll * get_all_permutations(struct\n \treturn hint[0];\n }\n \n-int is_superset(struct pack_list *pl, struct llist *list)\n+static int is_superset(struct pack_list *pl, struct llist *list)\n {\n \tstruct llist *diff;\n \n@@ -342,7 +342,7 @@ int is_superset(struct pack_list *pl, st\n \treturn 0;\n }\n \n-size_t sizeof_union(struct packed_git *p1, struct packed_git *p2)\n+static size_t sizeof_union(struct packed_git *p1, struct packed_git *p2)\n {\n \tsize_t ret = 0;\n \tint p1_off, p2_off;\n@@ -373,14 +373,14 @@ size_t sizeof_union(struct packed_git *p\n }\n \n /* another O(n^2) function ... */\n-size_t get_pack_redundancy(struct pack_list *pl)\n+static size_t get_pack_redundancy(struct pack_list *pl)\n {\n \tstruct pack_list *subset;\n+\tsize_t ret = 0;\n \n \tif (pl == NULL)\n \t\treturn 0;\n \n-\tsize_t ret = 0;\n \twhile ((subset = pl->next)) {\n \t\twhile(subset) {\n \t\t\tret += sizeof_union(pl->pack, subset->pack);\n@@ -391,7 +391,7 @@ size_t get_pack_redundancy(struct pack_l\n \treturn ret;\n }\n \n-inline size_t pack_set_bytecount(struct pack_list *pl)\n+static inline size_t pack_set_bytecount(struct pack_list *pl)\n {\n \tsize_t ret = 0;\n \twhile (pl) {\n@@ -402,7 +402,7 @@ inline size_t pack_set_bytecount(struct \n \treturn ret;\n }\n \n-void minimize(struct pack_list **min)\n+static void minimize(struct pack_list **min)\n {\n \tstruct pack_list *pl, *unique = NULL,\n \t\t*non_unique = NULL, *min_perm = NULL;\n@@ -469,7 +469,7 @@ void minimize(struct pack_list **min)\n \t}\n }\n \n-void load_all_objects()\n+static void load_all_objects(void)\n {\n \tstruct pack_list *pl = local_packs;\n \tstruct llist_item *hint, *l;\n@@ -497,7 +497,7 @@ void load_all_objects()\n }\n \n /* this scales like O(n^2) */\n-void cmp_local_packs()\n+static void cmp_local_packs(void)\n {\n \tstruct pack_list *subset, *pl = local_packs;\n \n@@ -508,7 +508,7 @@ void cmp_local_packs()\n \t}\n }\n \n-void scan_alt_odb_packs()\n+static void scan_alt_odb_packs(void)\n {\n \tstruct pack_list *local, *alt;\n \n@@ -524,7 +524,7 @@ void scan_alt_odb_packs()\n \t}\n }\n \n-struct pack_list * add_pack(struct packed_git *p)\n+static struct pack_list * add_pack(struct packed_git *p)\n {\n \tstruct pack_list l;\n \tsize_t off;\n@@ -550,7 +550,7 @@ struct pack_list * add_pack(struct packe\n \t\treturn pack_list_insert(&altodb_packs, &l);\n }\n \n-struct pack_list * add_pack_file(char *filename)\n+static struct pack_list * add_pack_file(char *filename)\n {\n \tstruct packed_git *p = packed_git;\n \n@@ -565,7 +565,7 @@ struct pack_list * add_pack_file(char *f\n \tdie(\"Filename %s not found in packed_git\\n\", filename);\n }\n \n-void load_all()\n+static void load_all(void)\n {\n \tstruct packed_git *p = packed_git;\n \ndiff --git a/path.c b/path.c\nindex d635470..84b3272 100644\n--- a/path.c\n+++ b/path.c\n@@ -131,7 +131,7 @@ int validate_symref(const char *path)\n \treturn -1;\n }\n \n-static char *current_dir()\n+static char *current_dir(void)\n {\n \treturn getcwd(pathname, sizeof(pathname));\n }\n---\n0.99.9.GIT\n"}]}