summaryrefslogtreecommitdiff
path: root/json_util.c
diff options
context:
space:
mode:
authorMichael Clark <michael@metaparadigm.com>2007-10-25 02:26:00 +0000
committerMichael Clark <michael@metaparadigm.com>2007-10-25 02:26:00 +0000
commitdfaf67043658eef1d76df9d3f71b4952302ee936 (patch)
tree50f32cf5a45eb0b833236268b438fd4fd8d9720b /json_util.c
parentecf2c9b74b0b6801e988629715cdcf113d389fad (diff)
downloadjson-c-dfaf67043658eef1d76df9d3f71b4952302ee936.tar.gz
* Add macros to enable compiling out debug code
Geoffrey Young, geoff at modperlcookbook dot org git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@18 327403b1-1117-474d-bef2-5cb71233fd97
Diffstat (limited to 'json_util.c')
-rw-r--r--json_util.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/json_util.c b/json_util.c
index e20be24..903a694 100644
--- a/json_util.c
+++ b/json_util.c
@@ -59,12 +59,12 @@ struct json_object* json_object_from_file(char *filename)
int fd, ret;
if((fd = open(filename, O_RDONLY)) < 0) {
- mc_error("json_object_from_file: error reading file %s: %s\n",
+ MC_ERROR("json_object_from_file: error reading file %s: %s\n",
filename, strerror(errno));
return error_ptr(-1);
}
if(!(pb = printbuf_new())) {
- mc_error("json_object_from_file: printbuf_new failed\n");
+ MC_ERROR("json_object_from_file: printbuf_new failed\n");
return error_ptr(-1);
}
while((ret = read(fd, buf, JSON_FILE_BUF_SIZE)) > 0) {
@@ -72,7 +72,7 @@ struct json_object* json_object_from_file(char *filename)
}
close(fd);
if(ret < 0) {
- mc_abort("json_object_from_file: error reading file %s: %s\n",
+ MC_ABORT("json_object_from_file: error reading file %s: %s\n",
filename, strerror(errno));
printbuf_free(pb);
return error_ptr(-1);
@@ -89,12 +89,12 @@ int json_object_to_file(char *filename, struct json_object *obj)
unsigned int wpos, wsize;
if(!obj) {
- mc_error("json_object_to_file: object is null\n");
+ MC_ERROR("json_object_to_file: object is null\n");
return -1;
}
if((fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0644)) < 0) {
- mc_error("json_object_to_file: error opening file %s: %s\n",
+ MC_ERROR("json_object_to_file: error opening file %s: %s\n",
filename, strerror(errno));
return -1;
}
@@ -107,7 +107,7 @@ int json_object_to_file(char *filename, struct json_object *obj)
while(wpos < wsize) {
if((ret = write(fd, json_str + wpos, wsize-wpos)) < 0) {
close(fd);
- mc_error("json_object_to_file: error writing file %s: %s\n",
+ MC_ERROR("json_object_to_file: error writing file %s: %s\n",
filename, strerror(errno));
return -1;
}