changeset 20760:15eefcabcb31

doc: Add docstring for internal function __varval__. * variables.cc (F__varval__): Add one sentence explanation of function. Recode to place input validation first.
author Rik <rik@octave.org>
date Wed, 25 Nov 2015 16:20:34 -0800
parents 2892f62fb37c
children 47cec845dd5a
files libinterp/corefcn/variables.cc
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc	Wed Nov 25 15:45:46 2015 -0800
+++ b/libinterp/corefcn/variables.cc	Wed Nov 25 16:20:34 2015 -0800
@@ -2654,20 +2654,18 @@
 DEFUN (__varval__, args, ,
        "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} __varval__ (@var{name})\n\
-Undocumented internal function.\n\
+Return the value of the variable @var{name} directly from the symbol table.\n\
 @end deftypefn")
 {
   octave_value retval;
 
-  if (args.length () == 1)
-    {
-      std::string name = args(0).xstring_value ("__varval__: first argument must be a variable name");
-
-      retval = symbol_table::varval (args(0).string_value ());
-    }
-  else
+  if (args.length () != 1)
     print_usage ();
 
+  std::string name = args(0).xstring_value ("__varval__: first argument must be a variable name");
+
+  retval = symbol_table::varval (args(0).string_value ());
+
   return retval;
 }