summaryrefslogtreecommitdiff
path: root/gtk/gtktextiter.c
diff options
context:
space:
mode:
authorSébastien Wilmet <swilmet@gnome.org>2014-08-15 20:54:01 +0200
committerSébastien Wilmet <swilmet@gnome.org>2014-08-20 19:19:10 +0200
commitf39d211021de7ebe4c0066b1a54272a4880e17be (patch)
tree2011e7d1f1f259983e9fce99e2f3030df46757ee /gtk/gtktextiter.c
parent7bc819e88d8880487653740f55e9bf072d5de36e (diff)
downloadgtk+-f39d211021de7ebe4c0066b1a54272a4880e17be.tar.gz
GtkTextView: various code clean-ups
- only one blank line is enough to separate code sections. - the 'signals' variable was in the middle of function prototypes. - compare pointers to NULL in some conditions ("if(blah) should be used only if blah is a boolean variable). It makes the code clearer. - various other things.
Diffstat (limited to 'gtk/gtktextiter.c')
-rw-r--r--gtk/gtktextiter.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index f215d1e2ce..7b58cb470d 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -2911,9 +2911,9 @@ find_word_end_func (const PangoLogAttr *attrs,
static gboolean
is_word_end_func (const PangoLogAttr *attrs,
- gint offset,
- gint min_offset,
- gint len)
+ gint offset,
+ gint min_offset,
+ gint len)
{
return attrs[offset].is_word_end;
}
@@ -2945,18 +2945,18 @@ find_word_start_func (const PangoLogAttr *attrs,
static gboolean
is_word_start_func (const PangoLogAttr *attrs,
- gint offset,
- gint min_offset,
- gint len)
+ gint offset,
+ gint min_offset,
+ gint len)
{
return attrs[offset].is_word_start;
}
static gboolean
inside_word_func (const PangoLogAttr *attrs,
- gint offset,
- gint min_offset,
- gint len)
+ gint offset,
+ gint min_offset,
+ gint len)
{
/* Find next word start or end */
while (offset >= min_offset &&
@@ -2998,9 +2998,9 @@ find_sentence_end_func (const PangoLogAttr *attrs,
static gboolean
is_sentence_end_func (const PangoLogAttr *attrs,
- gint offset,
- gint min_offset,
- gint len)
+ gint offset,
+ gint min_offset,
+ gint len)
{
return attrs[offset].is_sentence_end;
}
@@ -3032,18 +3032,18 @@ find_sentence_start_func (const PangoLogAttr *attrs,
static gboolean
is_sentence_start_func (const PangoLogAttr *attrs,
- gint offset,
- gint min_offset,
- gint len)
+ gint offset,
+ gint min_offset,
+ gint len)
{
return attrs[offset].is_sentence_start;
}
static gboolean
inside_sentence_func (const PangoLogAttr *attrs,
- gint offset,
- gint min_offset,
- gint len)
+ gint offset,
+ gint min_offset,
+ gint len)
{
/* Find next sentence start or end */
while (offset >= min_offset &&
@@ -3059,7 +3059,7 @@ test_log_attrs (const GtkTextIter *iter,
{
gint char_len;
const PangoLogAttr *attrs;
- int offset;
+ gint offset;
gboolean result = FALSE;
g_return_val_if_fail (iter != NULL, FALSE);
@@ -3071,12 +3071,11 @@ test_log_attrs (const GtkTextIter *iter,
/* char_len may be 0 and attrs will be NULL if so, if
* iter is the end iter and the last line is empty.
- *
+ *
* offset may be equal to char_len, since attrs contains an entry
- * for one past the end
+ * for one past the end.
*/
-
- if (attrs && offset <= char_len)
+ if (attrs != NULL && offset <= char_len)
result = (* func) (attrs, offset, 0, char_len);
return result;
@@ -3090,7 +3089,7 @@ find_line_log_attrs (const GtkTextIter *iter,
{
gint char_len;
const PangoLogAttr *attrs;
- int offset;
+ gint offset;
gboolean result = FALSE;
g_return_val_if_fail (iter != NULL, FALSE);
@@ -3101,10 +3100,9 @@ find_line_log_attrs (const GtkTextIter *iter,
offset = gtk_text_iter_get_line_offset (iter);
/* char_len may be 0 and attrs will be NULL if so, if
- * iter is the end iter and the last line is empty
+ * iter is the end iter and the last line is empty.
*/
-
- if (attrs)
+ if (attrs != NULL)
result = (* func) (attrs, offset, char_len, found_offset,
already_moved_initially);