diff -r 48b0adfe3059 -r e63951c1d0f8 librazor/iterator.c --- a/librazor/iterator.c Thu Jan 22 22:54:45 2009 +0000 +++ b/librazor/iterator.c Thu Nov 10 10:35:21 2011 +0000 @@ -231,7 +231,8 @@ } RAZOR_EXPORT struct razor_file_iterator * -razor_file_iterator_create(struct razor_set *set, struct razor_package *package) +razor_file_iterator_create(struct razor_set *set, struct razor_package *package, + int post_order) { struct razor_file_iterator *fi; @@ -240,7 +241,11 @@ fi = zalloc(sizeof *fi); fi->set = set; - fi->index = list_first(&package->files, &set->file_pool); + fi->post_order = post_order; + if (post_order) + fi->index = list_last(&package->files, &set->file_pool); + else + fi->index = list_first(&package->files, &set->file_pool); array_init(&fi->path); return fi; @@ -277,7 +282,10 @@ strcpy(fi->path.data, "/"); } *name = fi->path.data; - fi->index = list_next(fi->index); + if (fi->post_order) + fi->index = list_prev(fi->index); + else + fi->index = list_next(fi->index); return 1; } } while (!((e++)->flags & RAZOR_ENTRY_LAST));