[gjs/wip/mozjs-188: 9/10] Add wrappers for removed api, JS_NewNumberValue and JSVAL_IS_OBJECT()
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/mozjs-188: 9/10] Add wrappers for removed api, JS_NewNumberValue and JSVAL_IS_OBJECT()
- Date: Wed, 23 Jan 2013 21:54:52 +0000 (UTC)
commit bca65dfa9ee03deaf75923aaaa2cd25f9b21ff41
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()
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]