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/OptionValueSInt64.cpp b/lldb/source/Interpreter/OptionValueSInt64.cpp
index d62353d..97cdf10 100644
--- a/lldb/source/Interpreter/OptionValueSInt64.cpp
+++ b/lldb/source/Interpreter/OptionValueSInt64.cpp
@@ -36,9 +36,8 @@
 }
 
 Error
-OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
+OptionValueSInt64::SetValueFromString (llvm::StringRef value_ref, VarSetOperationType op)
 {
-    //printf ("%p: SetValueFromCString (s=\"%s\", op=%i)\n", this, value_cstr, op);
     Error error;
     switch (op)
     {
@@ -51,7 +50,7 @@
         case eVarSetOperationAssign:
             {
                 bool success = false;
-                std::string value_str = llvm::StringRef(value_cstr).trim().str();
+                std::string value_str = value_ref.trim().str();
                 int64_t value = StringConvert::ToSInt64 (value_str.c_str(), 0, 0, &success);
                 if (success)
                 {
@@ -69,7 +68,8 @@
                 }
                 else
                 {
-                    error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'", value_cstr);
+                    error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'",
+                            value_ref.str().c_str());
                 }
             }
             break;
@@ -79,7 +79,7 @@
         case eVarSetOperationRemove:
         case eVarSetOperationAppend:
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value_cstr, op);
+            error = OptionValue::SetValueFromString (value_ref, op);
             break;
     }
     return error;