Alexandre Julliard : jscript: Use the standard isfinite() function.

Alexandre Julliard julliard at winehq.org
Tue Nov 17 15:04:07 CST 2020


Module: wine
Branch: master
Commit: 061c747bfaeede8ee9566d9837c442f9415c80b3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=061c747bfaeede8ee9566d9837c442f9415c80b3

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Nov 17 10:12:44 2020 +0100

jscript: Use the standard isfinite() function.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/global.c  | 2 +-
 dlls/jscript/jscript.h | 1 -
 dlls/jscript/json.c    | 2 +-
 dlls/jscript/jsutils.c | 5 -----
 dlls/jscript/number.c  | 8 ++++----
 5 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c
index 64f7bbda959..d5aafe65037 100644
--- a/dlls/jscript/global.c
+++ b/dlls/jscript/global.c
@@ -238,7 +238,7 @@ static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
         if(FAILED(hres))
             return hres;
 
-        ret = is_finite(n);
+        ret = isfinite(n);
     }
 
     if(r)
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index e1ab5e5824f..dfe087521db 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -364,7 +364,6 @@ HRESULT variant_change_type(script_ctx_t*,VARIANT*,VARIANT*,VARTYPE) DECLSPEC_HI
 HRESULT decode_source(WCHAR*) DECLSPEC_HIDDEN;
 
 HRESULT double_to_string(double,jsstr_t**) DECLSPEC_HIDDEN;
-BOOL is_finite(double) DECLSPEC_HIDDEN;
 
 static inline BOOL is_digit(WCHAR c)
 {
diff --git a/dlls/jscript/json.c b/dlls/jscript/json.c
index 433c7858cb6..de10ceadd11 100644
--- a/dlls/jscript/json.c
+++ b/dlls/jscript/json.c
@@ -700,7 +700,7 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsval_t val)
     }
     case JSV_NUMBER: {
         double n = get_number(value);
-        if(is_finite(n)) {
+        if(isfinite(n)) {
             const WCHAR *ptr;
             jsstr_t *str;
 
diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c
index 421116f171b..b12addda794 100644
--- a/dlls/jscript/jsutils.c
+++ b/dlls/jscript/jsutils.c
@@ -51,11 +51,6 @@ const char *debugstr_jsval(const jsval_t v)
     return NULL;
 }
 
-BOOL is_finite(double n)
-{
-    return !isnan(n) && !isinf(n);
-}
-
 #define MIN_BLOCK_SIZE  128
 #define ARENA_FREE_FILLER  0xaa
 
diff --git a/dlls/jscript/number.c b/dlls/jscript/number.c
index 36384bf0621..fc6bfe10cc9 100644
--- a/dlls/jscript/number.c
+++ b/dlls/jscript/number.c
@@ -247,7 +247,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
 
     val = number->value;
 
-    if(radix==10 || !is_finite(val)) {
+    if(radix==10 || !isfinite(val)) {
         hres = to_string(ctx, jsval_number(val), &str);
         if(FAILED(hres))
             return hres;
@@ -373,7 +373,7 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
     }
 
     val = number->value;
-    if(!is_finite(val)) {
+    if(!isfinite(val)) {
         hres = to_string(ctx, jsval_number(val), &str);
         if(FAILED(hres))
             return hres;
@@ -414,7 +414,7 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
     }
 
     val = number->value;
-    if(!is_finite(val)) {
+    if(!isfinite(val)) {
         hres = to_string(ctx, jsval_number(val), &str);
         if(FAILED(hres))
             return hres;
@@ -455,7 +455,7 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
     }
 
     val = number->value;
-    if(!is_finite(val) || !prec) {
+    if(!isfinite(val) || !prec) {
         hres = to_string(ctx, jsval_number(val), &str);
         if(FAILED(hres))
             return hres;




More information about the wine-cvs mailing list