[gtksourceview] Small optimization for a common case (no marks)
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Small optimization for a common case (no marks)
- Date: Sun, 27 Jan 2013 10:47:16 +0000 (UTC)
commit ca0dcf67bfe3028404b836b98c04f68aa7105aae
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Jan 27 11:31:32 2013 +0100
Small optimization for a common case (no marks)
This function is called at every redraw, so it is worth catching this common case
gtksourceview/gtksourcebuffer.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index 45c95b9..0e66e52 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -2067,6 +2067,9 @@ gtk_source_buffer_get_source_marks_at_iter (GtkSourceBuffer *buffer,
g_return_val_if_fail (iter != NULL, NULL);
+ if (buffer->priv->source_marks->len == 0)
+ return NULL;
+
res = NULL;
marks = gtk_text_iter_get_marks (iter);
@@ -2114,6 +2117,9 @@ gtk_source_buffer_get_source_marks_at_line (GtkSourceBuffer *buffer,
g_return_val_if_fail (GTK_SOURCE_IS_BUFFER (buffer), NULL);
+ if (buffer->priv->source_marks->len == 0)
+ return NULL;
+
gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (buffer),
&iter, line);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]