[geany/geany-plugins] 62daca: Merge pull request #535 from frlan/enhancement/lineoperations/fix_cppcheck_error
Frank Lanitz
git-noreply at xxxxx
Sun Feb 26 11:13:18 UTC 2017
Branch: refs/heads/master
Author: Frank Lanitz <frank at frank.uvena.de>
Committer: GitHub <noreply at github.com>
Date: Sun, 26 Feb 2017 11:13:18 UTC
Commit: 62daca4492a93dec42df6ad0f8682b5f74e42da6
https://github.com/geany/geany-plugins/commit/62daca4492a93dec42df6ad0f8682b5f74e42da6
Log Message:
-----------
Merge pull request #535 from frlan/enhancement/lineoperations/fix_cppcheck_error
Add additional checks for doc != NULL and removing such ones later
Modified Paths:
--------------
lineoperations/src/lineoperations.c
Modified: lineoperations/src/lineoperations.c
14 lines changed, 7 insertions(+), 7 deletions(-)
===================================================================
@@ -160,6 +160,8 @@ action_indir_manip_item(GtkMenuItem *menuitem, gpointer gdata)
gint (*func)(gchar **lines, gint num_lines, gchar *new_file) = gdata;
GeanyDocument *doc = document_get_current();
+ g_return_if_fail(doc != NULL);
+
struct lo_lines sel = get_current_sel_lines(doc->editor->sci);
gint num_lines = (sel.end_line - sel.start_line) + 1;
@@ -191,10 +193,7 @@ action_indir_manip_item(GtkMenuItem *menuitem, gpointer gdata)
sci_start_undo_action(doc->editor->sci);
-
- if(doc)
- lines_affected = func(lines, num_lines, new_file);
-
+ lines_affected = func(lines, num_lines, new_file);
/* set new document */
sci_replace_sel(doc->editor->sci, new_file);
@@ -223,14 +222,15 @@ action_sci_manip_item(GtkMenuItem *menuitem, gpointer gdata)
/* function pointer to gdata -- function to be used */
gint (*func)(ScintillaObject *, gint, gint) = gdata;
GeanyDocument *doc = document_get_current();
+
+ g_return_if_fail(doc != NULL);
+
struct lo_lines sel = get_current_sel_lines(doc->editor->sci);
gint lines_affected = 0;
-
sci_start_undo_action(doc->editor->sci);
- if(doc)
- lines_affected = func(doc->editor->sci, sel.start_line, sel.end_line);
+ lines_affected = func(doc->editor->sci, sel.start_line, sel.end_line);
/* put message in ui_statusbar, and highlight lines that were affected */
user_indicate(doc->editor, lines_affected, sel);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list