Permalink
Browse files

Merge pull request #5 from catap/master

fix build with -Wall on gcc
  • Loading branch information...
2 parents c3eade0 + ca8a933 commit 0746461138d56981326aedcd34d10d6dcec82b49 @quartzjer committed Mar 10, 2012
Showing with 4 additions and 3 deletions.
  1. +1 −1 Makefile
  2. +3 −2 js0n.c
View
@@ -1,2 +1,2 @@
all:
- gcc -o js0n_test js0n_test.c js0n.c
+ gcc -Wall -o js0n_test js0n_test.c js0n.c
View
5 js0n.c
@@ -2,11 +2,12 @@
// public domain, contributions/improvements welcome via github
// opportunity to further optimize would be having different jump tables for higher depths
-#define PUSH(i) if(depth == 1) *out++ = ((cur+i) - js)
-#define CAP(i) if(depth == 1) *out++ = (cur+i) - (js + *(out-1)) + 1
+#define PUSH(i) if(depth == 1) prev = *out++ = ((cur+i) - js)
+#define CAP(i) if(depth == 1) prev = *out++ = ((cur+i) - (js + prev) + 1)
int js0n(unsigned char *js, unsigned int len, unsigned short *out)
{
+ unsigned short prev = 0;
unsigned char *cur, *end;
int depth=0;
int utf8_remain=0;

0 comments on commit 0746461

Please sign in to comment.