shithub: libmujs

Download patch

ref: 01d85a49949e513d82882239a028ca2ba0790b36
parent: 90c2ba0bf311101b59097b16bff4fc63016eb392
author: Tor Andersson <tor@ccxvii.net>
date: Wed Feb 26 12:35:18 EST 2014

Move nelem() macro into jsi.h

--- a/jsdump.c
+++ b/jsdump.c
@@ -7,8 +7,6 @@
 
 #include <assert.h>
 
-#define nelem(a) (sizeof (a) / sizeof (a)[0])
-
 static const char *astname[] = {
 #include "astnames.h"
 };
--- a/jsi.h
+++ b/jsi.h
@@ -27,6 +27,8 @@
 #define NAN (INFINITY-INFINITY)
 #endif
 
+#define nelem(a) (sizeof (a) / sizeof (a)[0])
+
 typedef struct js_Regexp js_Regexp;
 typedef struct js_Value js_Value;
 typedef struct js_Object js_Object;
--- a/jslex.c
+++ b/jslex.c
@@ -2,8 +2,6 @@
 #include "jslex.h"
 #include "utf.h"
 
-#define nelem(a) (sizeof (a) / sizeof (a)[0])
-
 JS_NORETURN static void jsY_error(js_State *J, const char *fmt, ...) JS_PRINTFLIKE(2,3);
 
 static void jsY_error(js_State *J, const char *fmt, ...)
--- a/jsparse.c
+++ b/jsparse.c
@@ -2,8 +2,6 @@
 #include "jslex.h"
 #include "jsparse.h"
 
-#define nelem(a) (sizeof (a) / sizeof (a)[0])
-
 #define LIST(h)		jsP_newnode(J, AST_LIST, h, 0, 0, 0)
 
 #define EXP0(x)		jsP_newnode(J, EXP_ ## x, 0, 0, 0, 0)
--- a/jsregexp.c
+++ b/jsregexp.c
@@ -3,8 +3,6 @@
 #include "jsbuiltin.h"
 #include "regex.h"
 
-#define nelem(a) (sizeof (a) / sizeof (a)[0])
-
 void js_newregexp(js_State *J, const char *pattern, int flags)
 {
 	const char *error;
--- a/jsstring.c
+++ b/jsstring.c
@@ -4,8 +4,6 @@
 #include "utf.h"
 #include "regex.h"
 
-#define nelem(a) (sizeof (a) / sizeof (a)[0])
-
 int js_runeat(js_State *J, const char *s, int i)
 {
 	Rune rune = 0;