[gjs/wip/js17: 10/12] Add wrappers for removed api, JS_NewNumberValue and JSVAL_IS_OBJECT()



commit 5e00565c5c415b10ab6cff7021ae8c6553a15480
Author: Tim Lunn <tim feathertop org>
Date:   Thu Jan 10 13:30:00 2013 +1100

    Add wrappers for removed api, JS_NewNumberValue and JSVAL_IS_OBJECT()
    
    Both these api are deprecated and removed. For now add wrappers to compat.h that
    provide equivalent functionality.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690982

 gjs/compat.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gjs/compat.h b/gjs/compat.h
index f5e9634..af8e317 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -45,6 +45,16 @@ G_BEGIN_DECLS
  * See https://bugzilla.gnome.org/show_bug.cgi?id=622896 for some initial discussion.
  */
 
+#define JSVAL_IS_OBJECT(obj) (JSVAL_IS_NULL(obj) || !JSVAL_IS_PRIMITIVE(obj))
+
+static JSBool JS_NewNumberValue(JSContext *cx, double d, jsval *rval)
+    {
+        *rval = JS_NumberValue(d);
+        if (JSVAL_IS_NUMBER(*rval))
+            return JS_TRUE;
+        return JS_FALSE;
+    }
+
 /**
  * GJS_NATIVE_CONSTRUCTOR_DECLARE:
  * Prototype a constructor.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]