[latexila] Vala: check if an out arg is null is no longer required



commit 64ad47def403fbcda1afce02499d9e910cffc84c
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Thu Jun 23 02:00:39 2011 +0200

    Vala: check if an out arg is null is no longer required

 src/completion.vala         |   23 ++++++++---------------
 src/document_structure.vala |    9 +++------
 src/document_view.vala      |    3 ++-
 src/file_browser.vala       |    4 +++-
 src/structure_model.vala    |    4 ----
 src/utils.vala              |    5 +----
 6 files changed, 17 insertions(+), 31 deletions(-)
---
diff --git a/src/completion.vala b/src/completion.vala
index cd44c1a..073c89b 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -809,11 +809,8 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
         bool in_other_argument = false;
         char other_argument_opening_bracket = '{';
 
-        if (&arguments != null)
-            arguments = new Gee.ArrayList<bool> ();
-
-        if (&valid_arg_contents != null)
-            valid_arg_contents = true;
+        arguments = new Gee.ArrayList<bool> ();
+        valid_arg_contents = true;
 
         for (long i = text.length - 1 ; i >= 0 ; i--)
         {
@@ -823,10 +820,9 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
                 if ((text[i] == '{' || text[i] == '[')
                     && ! Utils.char_is_escaped (text, i))
                 {
-                    if (&arguments != null)
-                        arguments.insert (0, text[i] == '[');
+                    arguments.insert (0, text[i] == '[');
 
-                    if (&argument_contents != null && index_start_argument_contents != -1)
+                    if (index_start_argument_contents != -1)
                         argument_contents =
                             text[index_start_argument_contents : text.length];
 
@@ -836,7 +832,7 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
                 }
 
                 // invalid argument content (no choice available)
-                if (&valid_arg_contents != null && ! text[i].isalpha () && text[i] != '*')
+                if (! text[i].isalpha () && text[i] != '*')
                     valid_arg_contents = false;
 
                 index_start_argument_contents = i;
@@ -860,10 +856,8 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
                 // last character of the command name
                 if (text[i].isalpha () || text[i] == '*')
                 {
-                    string tmp = get_latex_command_at_index (text, i);
-                    if (&cmd_name != null)
-                        cmd_name = tmp;
-                    return tmp != null;
+                    cmd_name = get_latex_command_at_index (text, i);
+                    return cmd_name != null;
                 }
 
                 // maybe the end of another argument
@@ -875,8 +869,7 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
                     in_other_argument = true;
                     other_argument_opening_bracket = text[i] == '}' ? '{' : '[';
 
-                    if (&arguments != null)
-                        arguments.insert (0, text[i] == ']');
+                    arguments.insert (0, text[i] == ']');
                     continue;
                 }
 
diff --git a/src/document_structure.vala b/src/document_structure.vala
index d83ae67..ee5168a 100644
--- a/src/document_structure.vala
+++ b/src/document_structure.vala
@@ -202,12 +202,9 @@ public class DocumentStructure : GLib.Object
         if (! _command_name_regex.match (after_backslash_text, 0, out match_info))
             return null;
 
-        if (&begin_contents_index != null)
-        {
-            int pos;
-            match_info.fetch_pos (0, null, out pos);
-            begin_contents_index = pos + after_backslash_index;
-        }
+        int pos;
+        match_info.fetch_pos (0, null, out pos);
+        begin_contents_index = pos + after_backslash_index;
 
         return match_info.fetch_named ("name");
     }
diff --git a/src/document_view.vala b/src/document_view.vala
index a21c337..ce45279 100644
--- a/src/document_view.vala
+++ b/src/document_view.vala
@@ -193,7 +193,8 @@ public class DocumentView : Gtk.SourceView
     {
         // See GDK_KEY_BackSpace in gdk/gdkkeysyms.h (not available in Vala)
 
-        // TODO connect/disconnect the signal when settings in gsettings change
+        // TODO~ connect/disconnect the signal when settings in gsettings change
+        // note: this function will be removed when latexila will become a Gedit plugin...
         if (! editor_settings.get_boolean ("insert-spaces")
             || ! editor_settings.get_boolean ("forget-no-tabs")
             || event.keyval != 0xff08
diff --git a/src/file_browser.vala b/src/file_browser.vala
index 8bf3d42..e2cfcd0 100644
--- a/src/file_browser.vala
+++ b/src/file_browser.vala
@@ -343,7 +343,9 @@ public class FileBrowser : VBox
                 directory = File.new_for_path (Environment.get_home_dir ());
         }
 
-        // TODO try (haha) to put the minimum code in the try
+        // TODO~ try (haha) to put the minimum code in the try
+        // note: the file browser will be removed when latexila will become a
+        // Gedit plugin...
         try
         {
             FileEnumerator enumerator = directory.enumerate_children (
diff --git a/src/structure_model.vala b/src/structure_model.vala
index d8cb9c0..7bdefe9 100644
--- a/src/structure_model.vala
+++ b/src/structure_model.vala
@@ -227,8 +227,6 @@ public class StructureModel : TreeModel, GLib.Object
         if (node.is_leaf ())
             return false;
 
-        // FIXME check if &iter is null?
-        // I think there is an easier method now.
         iter = create_iter_at_node (node.first_child ());
         return true;
     }
@@ -263,8 +261,6 @@ public class StructureModel : TreeModel, GLib.Object
         if (n < 0 || node.n_children () <= n)
             return false;
 
-        // FIXME check if &iter is null?
-        // I think there is an easier method now.
         iter = create_iter_at_node (node.nth_child ((uint) n));
         return true;
     }
diff --git a/src/utils.vala b/src/utils.vala
index 078440e..21265d2 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -222,14 +222,11 @@ namespace Utils
 
     // get indice of selected row in the treeview
     // returns -1 if no row is selected
-    public int get_selected_row (TreeView view, out TreeIter iter_to_set = null)
+    public int get_selected_row (TreeView view, out TreeIter iter = null)
     {
         TreeSelection select = view.get_selection ();
-        TreeIter iter;
         if (select.get_selected (null, out iter))
         {
-            if (&iter_to_set != null)
-                iter_to_set = iter;
             TreeModel model = view.get_model ();
             TreePath path = model.get_path (iter);
             return path.get_indices ()[0];



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]