move definition of cmp_entries() closer to point of use
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
diff --git a/lib/fileindex.c b/lib/fileindex.c
index 54dd0e8..0116d68 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -547,25 +547,6 @@ got_fileindex_read(struct got_fileindex *fileindex, FILE *infile)
return NULL;
}
-/*
- * Decide whether ie or te are equivalent, and if they aren't,
- * then decide which should be processed first.
- */
-static int
-cmp_entries(struct got_fileindex_entry *ie, const char *parent_path,
- size_t parent_len, struct got_tree_entry *te)
-{
- int cmp = strncmp(ie->path, parent_path, parent_len);
- if (cmp == 0 || parent_len == 0) {
- char *ie_name = ie->path + parent_len;
- while (ie_name[0] == '/')
- ie_name++;
- cmp = strcmp(ie_name, te->name);
- }
- return cmp;
-
-}
-
static const struct got_error *
diff_fileindex_tree(struct got_fileindex *, struct got_fileindex_entry **,
struct got_tree_object *, const char *, struct got_repository *,
@@ -619,6 +600,25 @@ walk_tree(struct got_tree_entry **next, struct got_fileindex *fileindex,
return NULL;
}
+/*
+ * Decide whether ie or te are equivalent, and if they aren't,
+ * then decide which should be processed first.
+ */
+static int
+cmp_entries(struct got_fileindex_entry *ie, const char *parent_path,
+ size_t parent_len, struct got_tree_entry *te)
+{
+ int cmp = strncmp(ie->path, parent_path, parent_len);
+ if (cmp == 0 || parent_len == 0) {
+ char *ie_name = ie->path + parent_len;
+ while (ie_name[0] == '/')
+ ie_name++;
+ cmp = strcmp(ie_name, te->name);
+ }
+ return cmp;
+
+}
+
static const struct got_error *
diff_fileindex_tree(struct got_fileindex *fileindex,
struct got_fileindex_entry **ie, struct got_tree_object *tree,