From dc9df84693a3c5f20b212f322504c0d5a402d300 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 8 Aug 2012 13:37:20 +0400 Subject: [PATCH] Ticket #1977: type accuracy of WEdit members and mceditor functions. (line_is_blank): return gboolean instead of int. Signed-off-by: Andrew Borodin --- src/editor/edit-impl.h | 2 +- src/editor/edit.c | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h index 3560da4eb..7ef464cc3 100644 --- a/src/editor/edit-impl.h +++ b/src/editor/edit-impl.h @@ -316,7 +316,7 @@ void book_mark_dec (WEdit * edit, int line); void book_mark_serialize (WEdit * edit, int color); void book_mark_restore (WEdit * edit, int color); -int line_is_blank (WEdit * edit, long line); +gboolean line_is_blank (WEdit * edit, long line); gboolean is_break_char (char c); int edit_indent_width (WEdit * edit, long p); void edit_insert_indent (WEdit * edit, int indent); diff --git a/src/editor/edit.c b/src/editor/edit.c index d290d81aa..7383b2066 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -735,24 +735,31 @@ is_in_indent (WEdit * edit) } /* --------------------------------------------------------------------------------------------- */ +/** check whether line in editor is blank or not + * + * @param edit editor object + * @param offset position in file + * + * @return TRUE if line in blank, FALSE otherwise + */ -static int +static gboolean is_blank (WEdit * edit, long offset) { long s, f; int c; + s = edit_bol (edit, offset); f = edit_eol (edit, offset) - 1; while (s <= f) { c = edit_get_byte (edit, s++); if (!isspace (c)) - return 0; + return FALSE; } - return 1; + return TRUE; } - /* --------------------------------------------------------------------------------------------- */ /** returns the offset of line i */ @@ -3220,8 +3227,15 @@ edit_move_to_prev_col (WEdit * edit, long p) } /* --------------------------------------------------------------------------------------------- */ +/** check whether line in editor is blank or not + * + * @param edit editor object + * @param line number of line + * + * @return TRUE if line in blank, FALSE otherwise + */ -int +gboolean line_is_blank (WEdit * edit, long line) { return is_blank (edit, edit_find_line (edit, line)); -- 2.11.4.GIT