Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix build with -Wall by gcc

  • Loading branch information...
commit ca8a933356919fe2c6d1c649a2ae34897ec49570 1 parent c3eade0
@catap catap authored
Showing with 4 additions and 3 deletions.
  1. +1 −1  Makefile
  2. +3 −2 js0n.c
View
2  Makefile
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.