Branch: refs/heads/master Author: Pavel Roschin roshin@scriptumplus.ru Committer: Pavel Roschin roshin@scriptumplus.ru Date: Wed, 23 Oct 2013 19:01:13 UTC Commit: d9e73e61feee780c50d197aade4210419ef3bb7e https://github.com/geany/geany-plugins/commit/d9e73e61feee780c50d197aade4210...
Log Message: ----------- Homogenize checks, fix doc checking, remove define warnings
Modified Paths: -------------- autoclose/src/autoclose.c
Modified: autoclose/src/autoclose.c 22 files changed, 13 insertions(+), 9 deletions(-) =================================================================== @@ -52,6 +52,10 @@ "0.2", "Pavel Roschin <rpg89(at)post(dot)ru>")
+/* avoid aggresive warnings */ +#undef DOC_VALID +#define DOC_VALID(doc_ptr) (((doc_ptr) && (doc_ptr)->is_valid)) + typedef struct { /* close chars */ gboolean parenthesis; @@ -591,7 +595,7 @@ line = sci_get_line_from_position(sci, pos); len = strlen(str); const gchar *sci_buf = get_char_range(sci, get_indent(sci, line), len); - g_return_val_if_fail(NULL != sci_buf, FALSE); + g_return_val_if_fail(sci_buf, FALSE); if (strncmp(sci_buf, str, len) == 0) return TRUE; return FALSE; @@ -623,7 +627,7 @@ struct_semicolon( gint line) { const gchar* sci_buf = get_char_range(sci, get_indent(sci, line), 7); - g_return_val_if_fail(NULL != sci_buf, FALSE); + g_return_val_if_fail(sci_buf, FALSE); if (strncmp(sci_buf, "#define", 7) == 0) return TRUE; return FALSE; @@ -645,13 +649,13 @@ struct_semicolon( gboolean has_sel; gint filetype = 0;
- g_return_val_if_fail(NULL != data, AC_CONTINUE_ACTION); + g_return_val_if_fail(data, AC_CONTINUE_ACTION); doc = data->doc; - g_return_val_if_fail(NULL != doc, AC_CONTINUE_ACTION); + g_return_val_if_fail(DOC_VALID(doc), AC_CONTINUE_ACTION); editor = doc->editor; - g_return_val_if_fail(NULL != editor, AC_CONTINUE_ACTION); + g_return_val_if_fail(editor, AC_CONTINUE_ACTION); sci = editor->sci; - g_return_val_if_fail(NULL != sci, AC_CONTINUE_ACTION); + g_return_val_if_fail(sci, AC_CONTINUE_ACTION);
if (doc->file_type) filetype = doc->file_type->id; @@ -763,7 +767,7 @@ struct_semicolon( on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { AutocloseUserData *data = user_data; - g_return_val_if_fail(NULL != data && NULL != data->doc, AC_CONTINUE_ACTION); + g_return_val_if_fail(data && DOC_VALID(data->doc), AC_CONTINUE_ACTION); return auto_close_chars(data, event); }
@@ -774,8 +778,8 @@ struct_semicolon(
if (!ac_info->jump_on_tab) return; - if (!data || !data->doc || !data->doc->editor || !data->doc->editor->sci) - return; + g_return_if_fail(data); + g_return_if_fail(DOC_VALID(data->doc));
ScintillaObject *sci = data->doc->editor->sci; /* reset jump_on_tab state when user clicked away */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).