Skip to content
Snippets Groups Projects
Commit 087a743e authored by rswindell's avatar rswindell
Browse files

Using JSAPI function JS_GetClass() instead of private OBJ_GET_CLASS() macro

(which requires #inclusion of private jsobj.h header file) in js_socket().
To get the correct prototype for JS_GetClass, JS_THREADSAFE must be defined
(next commit).
parent 7e01766b
No related branches found
No related tags found
No related merge requests found
......@@ -39,8 +39,6 @@
#ifdef JAVASCRIPT
#include <jsobj.h> /* Needed for OBJ_GET_CLASS macro */
typedef struct
{
SOCKET sock;
......@@ -147,10 +145,11 @@ static ushort js_port(JSContext* cx, jsval val, int type)
SOCKET DLLCALL js_socket(JSContext *cx, jsval val)
{
void* vp;
JSClass* cl;
SOCKET sock=INVALID_SOCKET;
if(JSVAL_IS_OBJECT(val)) {
if(OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(val))->flags & JSCLASS_HAS_PRIVATE)
if(JSVAL_IS_OBJECT(val) && (cl=JS_GetClass(cx,JSVAL_TO_OBJECT(val)))!=NULL) {
if(cl->flags&JSCLASS_HAS_PRIVATE)
if((vp=JS_GetPrivate(cx,JSVAL_TO_OBJECT(val)))!=NULL)
sock=*(SOCKET*)vp;
} else if(val!=JSVAL_VOID)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment