1.1 --- a/librazor/iterator.c Thu Jan 22 22:54:45 2009 +0000
1.2 +++ b/librazor/iterator.c Fri Apr 23 19:14:17 2010 +0100
1.3 @@ -231,7 +231,8 @@
1.4 }
1.5
1.6 RAZOR_EXPORT struct razor_file_iterator *
1.7 -razor_file_iterator_create(struct razor_set *set, struct razor_package *package)
1.8 +razor_file_iterator_create(struct razor_set *set, struct razor_package *package,
1.9 + int post_order)
1.10 {
1.11 struct razor_file_iterator *fi;
1.12
1.13 @@ -240,7 +241,11 @@
1.14
1.15 fi = zalloc(sizeof *fi);
1.16 fi->set = set;
1.17 - fi->index = list_first(&package->files, &set->file_pool);
1.18 + fi->post_order = post_order;
1.19 + if (post_order)
1.20 + fi->index = list_last(&package->files, &set->file_pool);
1.21 + else
1.22 + fi->index = list_first(&package->files, &set->file_pool);
1.23 array_init(&fi->path);
1.24
1.25 return fi;
1.26 @@ -277,7 +282,10 @@
1.27 strcpy(fi->path.data, "/");
1.28 }
1.29 *name = fi->path.data;
1.30 - fi->index = list_next(fi->index);
1.31 + if (fi->post_order)
1.32 + fi->index = list_prev(fi->index);
1.33 + else
1.34 + fi->index = list_next(fi->index);
1.35 return 1;
1.36 }
1.37 } while (!((e++)->flags & RAZOR_ENTRY_LAST));