* Don't use this as a variable, so we can compile with a C++ compiler

* Add casts from void* to type of assignment when using malloc 
  * Add #ifdef __cplusplus guards to all of the headers
  * Add typedefs for json_object, json_tokener, array_list, printbuf, lh_table
    Michael Clark, <michael@metaparadigm.com>


git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@33 327403b1-1117-474d-bef2-5cb71233fd97
This commit is contained in:
Michael Clark
2009-02-25 02:31:32 +00:00
parent 266a3fd301
commit aaec1ef3c5
17 changed files with 101 additions and 27 deletions

View File

@@ -29,10 +29,11 @@ struct printbuf* printbuf_new(void)
{
struct printbuf *p;
if(!(p = calloc(1, sizeof(struct printbuf)))) return NULL;
p = (struct printbuf*)calloc(1, sizeof(struct printbuf));
if(!p) return NULL;
p->size = 32;
p->bpos = 0;
if(!(p->buf = malloc(p->size))) {
if(!(p->buf = (char*)malloc(p->size))) {
free(p);
return NULL;
}
@@ -50,7 +51,7 @@ int printbuf_memappend(struct printbuf *p, const char *buf, int size)
"bpos=%d wrsize=%d old_size=%d new_size=%d\n",
p->bpos, size, p->size, new_size);
#endif /* PRINTBUF_DEBUG */
if(!(t = realloc(p->buf, new_size))) return -1;
if(!(t = (char*)realloc(p->buf, new_size))) return -1;
p->size = new_size;
p->buf = t;
}