commit 70e2377c0226613312687962277bc22835bbf250 from: Stefan Sperling date: Mon Jan 28 22:54:46 2019 UTC move definition of cmp_entries() closer to point of use commit - 63de41366136877da3e3da97069a20bd177f0d3a commit + 70e2377c0226613312687962277bc22835bbf250 blob - 54dd0e8231693c608ac065679a291cd4cf9e0719 blob + 0116d689259b746f3b210c9d0268f0d4a67ad2cf --- lib/fileindex.c +++ lib/fileindex.c @@ -545,25 +545,6 @@ got_fileindex_read(struct got_fileindex *fileindex, FI return got_error(GOT_ERR_FILEIDX_CSUM); 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 * @@ -619,6 +600,25 @@ walk_tree(struct got_tree_entry **next, struct got_fil 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,