Replace strtod() with builtin string to number conversion.

This commit is contained in:
Mike Pall
2012-08-25 23:02:29 +02:00
parent 653facd0d5
commit 4c882fe714
24 changed files with 660 additions and 272 deletions

View File

@@ -31,6 +31,7 @@
#include "lj_ff.h"
#include "lj_dispatch.h"
#include "lj_char.h"
#include "lj_strscan.h"
#include "lj_lib.h"
/* -- Base library: checks ------------------------------------------------ */
@@ -191,7 +192,7 @@ LJLIB_ASM(tonumber) LJLIB_REC(.)
int32_t base = lj_lib_optint(L, 2, 10);
if (base == 10) {
TValue *o = lj_lib_checkany(L, 1);
if (tvisnumber(o) || (tvisstr(o) && lj_str_tonumber(strV(o), o))) {
if (lj_strscan_numberobj(o)) {
copyTV(L, L->base-1, o);
return FFH_RES(1);
}