Internals: Refactor to decouple LinkDot from ParseImp. No functional change intended.

This commit is contained in:
Wilson Snyder
2020-06-07 08:21:22 -04:00
parent 0098e67e59
commit 01255082a6
6 changed files with 34 additions and 28 deletions
+18
View File
@@ -121,6 +121,24 @@ bool VString::isWhitespace(const string& str) {
return true;
}
double VString::parseDouble(const string& str, bool* successp) {
char* strgp = new char[str.size() + 1];
char* dp = strgp;
if (successp) *successp = true;
for (const char* sp = str.c_str(); *sp; ++sp) {
if (*sp != '_') *dp++ = *sp;
}
*dp++ = '\0';
char* endp = strgp;
double d = strtod(strgp, &endp);
size_t parsed_len = endp - strgp;
if (parsed_len != strlen(strgp)) {
if (successp) *successp = false;
}
VL_DO_DANGLING(delete[] strgp, strgp);
return d;
}
//######################################################################
// VHashSha256