Refactor OptionValue::SetValueFromCString to use llvm::StringRef

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7676

llvm-svn: 230005
diff --git a/lldb/source/Interpreter/OptionValueBoolean.cpp b/lldb/source/Interpreter/OptionValueBoolean.cpp
index 71cc2af..dae1f4b 100644
--- a/lldb/source/Interpreter/OptionValueBoolean.cpp
+++ b/lldb/source/Interpreter/OptionValueBoolean.cpp
@@ -37,7 +37,7 @@
 }
 
 Error
-OptionValueBoolean::SetValueFromCString (const char *value_cstr,
+OptionValueBoolean::SetValueFromString (llvm::StringRef value_str,
                                          VarSetOperationType op)
 {
     Error error;
@@ -52,7 +52,7 @@
     case eVarSetOperationAssign:
         {
             bool success = false;
-            bool value = Args::StringToBoolean(value_cstr, false, &success);
+            bool value = Args::StringToBoolean(value_str.str().c_str(), false, &success);
             if (success)
             {
                 m_value_was_set = true;
@@ -61,12 +61,11 @@
             }
             else
             {
-                if (value_cstr == nullptr)
-                    error.SetErrorString ("invalid boolean string value: NULL");
-                else if (value_cstr[0] == '\0')
+                if (value_str.size() == 0)
                     error.SetErrorString ("invalid boolean string value <empty>");
                 else
-                    error.SetErrorStringWithFormat ("invalid boolean string value: '%s'", value_cstr);
+                    error.SetErrorStringWithFormat ("invalid boolean string value: '%s'",
+                            value_str.str().c_str());
             }
         }
         break;
@@ -76,7 +75,7 @@
     case eVarSetOperationRemove:
     case eVarSetOperationAppend:
     case eVarSetOperationInvalid:
-        error = OptionValue::SetValueFromCString (value_cstr, op);
+        error = OptionValue::SetValueFromString (value_str, op);
         break;
     }
     return error;