Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Sj.h: A tiny little JSON parsing library in ~150 lines of C99. Parent comment
diff --git a/sj.h b/sj.h index 60bea9e..25f6438 100644 --- a/sj.h +++ b/sj.h @@ -85,6 +85,7 @@ top: return res; case '{': case '[': + if (r->depth > 999) { r->error = "can't go deeper"; goto top; } res.type = (*r->cur == '{') ? SJ_OBJECT : SJ_ARRAY; res.depth = ++r->depth; r->cur++;