[evince/outline-collapse-all: 50/50] Add comment about logic of 'first_iteration'
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/outline-collapse-all: 50/50] Add comment about logic of 'first_iteration'
- Date: Sat, 26 Jun 2021 05:14:20 +0000 (UTC)
commit a5089428e03a740fa13538cba608da27353757da
Author: Nelson Benítez León <nbenitezl gmail com>
Date: Fri Jun 25 21:52:52 2021 -0400
Add comment about logic of 'first_iteration'
shell/ev-sidebar-links.c | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index 0081562b..758f82fa 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -534,6 +534,11 @@ remove_path_descendants (const gchar *metadata_index, GtkTreePath *path)
g_free (ret);
ret = g_strdup ("");
}
+ /* Purpose of 'first_iteration' is so that, just in the first iteration, we don't
+ * free 'haystack'. In first iteration, 'haystack' references const char data, while
+ * subsequent iterations will reference allocated char data. This optimization is to
+ * avoid an initial g_strdup() of the passed in 'const gchar *metadata_index' string,
+ * which can be large in documents with big outlines. */
if (!first_iteration)
g_free (haystack);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]