summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-10 09:46:13 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-10 09:46:13 +0000
commit8d986c31c7d47c2c6f8c5e2eab34b6467ed9365e (patch)
tree3fba59acdeef96c1f511904f5328707c785d11ad
parent19571b677ec4a1c3fd488b4f0d4084d011729bfa (diff)
invalidate previous files path iterator if something doesn't match, to avoid unnecessary checks.
-rw-r--r--src/trg-file-parser.c8
-rw-r--r--src/trg-files-model.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/src/trg-file-parser.c b/src/trg-file-parser.c
index 3353cd9..da34a5a 100644
--- a/src/trg-file-parser.c
+++ b/src/trg-file-parser.c
@@ -60,10 +60,12 @@ static trg_files_tree_node
trg_files_tree_node *lastPathNode =
(trg_files_tree_node *) li->data;
- if (!g_strcmp0(lastPathNode->name, path_el_node->val.s))
+ if (!g_strcmp0(lastPathNode->name, path_el_node->val.s)) {
target_node = lastPathNode;
-
- li = g_list_next(li);
+ li = g_list_next(li);
+ } else {
+ li = NULL;
+ }
}
if (!target_node) {
diff --git a/src/trg-files-model.c b/src/trg-files-model.c
index de5d54b..ab9eec5 100644
--- a/src/trg-files-model.c
+++ b/src/trg-files-model.c
@@ -159,10 +159,12 @@ static trg_files_tree_node
trg_files_tree_node *lastPathNode =
(trg_files_tree_node *) li->data;
- if (!g_strcmp0(lastPathNode->name, path[i]))
+ if (!g_strcmp0(lastPathNode->name, path[i])) {
target_node = lastPathNode;
-
- li = g_list_next(li);
+ li = g_list_next(li);
+ } else {
+ li = NULL;
+ }
}
if (!target_node) {