Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

errno isn't used so remove include of errno.h.

initialize json to NULL to avoid realloc crash.
use memset instead of obsolete bzero.
  • Loading branch information...
commit c3eade0482f429256c2760cce50d7244f0c5fe2b 1 parent 163971a
Bruce Cran authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 js0n_test.c
View
5 js0n_test.c
@@ -1,12 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
-#include <errno.h>
#include <string.h>
#include "js0n.h"
int main(int argc, char **argv)
{
- unsigned char buff[1024], *json;
+ unsigned char buff[1024], *json = NULL;
int len, lastlen=0, ret, i;
unsigned short *res;
FILE *f;
@@ -25,7 +24,7 @@ int main(int argc, char **argv)
fclose(f);
printf("got[%.*s]\n",lastlen,json);
res = malloc(lastlen); // way more than enough
- bzero(res,lastlen);
+ memset(res,0,lastlen);
ret = js0n(json,lastlen,res);
printf("returned %d\n",ret);
for(i=0;res[i];i+=2)
Please sign in to comment.
Something went wrong with that request. Please try again.