shithub: libmujs

Download patch

ref: 9f7141ce3047e0512dfd765553af7464975ea2d7
parent: 759d60958847720ee82f9db134f218d14be3f6b3
author: Tor Andersson <[email protected]>
date: Thu Feb 13 07:06:27 EST 2014

Make array length helper public.

--- a/js.h
+++ b/js.h
@@ -97,6 +97,8 @@
 void js_delproperty(js_State *J, int idx, const char *name);
 void js_defaccessor(js_State *J, int idx, const char *name, int atts);
 
+unsigned int js_getlength(js_State *J, int idx);
+void js_setlength(js_State *J, int idx, unsigned int len);
 int js_hasindex(js_State *J, int idx, unsigned int i);
 void js_getindex(js_State *J, int idx, unsigned int i);
 void js_setindex(js_State *J, int idx, unsigned int i);
--- a/jsarray.c
+++ b/jsarray.c
@@ -2,7 +2,7 @@
 #include "jsvalue.h"
 #include "jsbuiltin.h"
 
-static unsigned int js_getlength(js_State *J, int idx)
+unsigned int js_getlength(js_State *J, int idx)
 {
 	unsigned int len;
 	js_getproperty(J, idx, "length");
@@ -11,7 +11,7 @@
 	return len;
 }
 
-static void js_setlength(js_State *J, int idx, unsigned int len)
+void js_setlength(js_State *J, int idx, unsigned int len)
 {
 	js_pushnumber(J, len);
 	js_setproperty(J, idx, "length");