optimize code

This commit is contained in:
ValKmjolnir
2023-12-05 23:54:26 +08:00
parent 3b1659e7ee
commit f747d91efe
10 changed files with 36 additions and 24 deletions

View File

@@ -241,7 +241,7 @@ void json::vector_member(nas_vec& vec, gc* ngc) {
vec.elems.push_back(ngc->newstr(this_token.content));
next();
} else if (this_token.type==token_type::tok_num) {
vec.elems.push_back(var::num(str2num(this_token.content.c_str())));
vec.elems.push_back(var::num(str_to_num(this_token.content.c_str())));
next();
}
}
@@ -280,7 +280,7 @@ void json::hash_member(nas_hash& hash, gc* ngc) {
hash.elems.insert({name, ngc->newstr(this_token.content)});
next();
} else if (this_token.type==token_type::tok_num) {
hash.elems.insert({name, var::num(str2num(this_token.content.c_str()))});
hash.elems.insert({name, var::num(str_to_num(this_token.content.c_str()))});
next();
}
}

View File

@@ -7,6 +7,10 @@
#include <unistd.h>
#endif
#ifdef _MSC_VER
#pragma warning (disable:4996)
#endif
#ifdef _WIN32
#include <conio.h>
#else

View File

@@ -6,6 +6,10 @@
#include <unistd.h>
#endif
#ifdef _MSC_VER
#pragma warning (disable:4996)
#endif
#ifdef _WIN32
#include <winsock.h>
#pragma comment(lib,"ws2_32")