]> granicus.if.org Git - json-c/commitdiff
Eliminate use of MC_ABORT in json-c code, and mark MC_ABORT/mc_abort deprecated.
authorEric Haszlakiewicz <erh+git@nimenees.com>
Sat, 29 Jun 2013 20:31:18 +0000 (15:31 -0500)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Sat, 29 Jun 2013 20:31:18 +0000 (15:31 -0500)
Also adjust an error message in json_util to make it unique.  Fixes #87.

debug.h
json_util.c

diff --git a/debug.h b/debug.h
index 1e0970173636ec694b328329a184178e0c68f47a..f2dc5411e19c6424b512e238234ff175a36c678b 100644 (file)
--- a/debug.h
+++ b/debug.h
@@ -23,6 +23,10 @@ extern void mc_set_debug(int debug);
 extern int mc_get_debug(void);
 
 extern void mc_set_syslog(int syslog);
+
+/**
+ * @deprecated Use mc_error(), and return an appropriate error.
+ */
 extern void mc_abort(const char *msg, ...);
 extern void mc_debug(const char *msg, ...);
 extern void mc_error(const char *msg, ...);
@@ -48,6 +52,9 @@ extern void mc_info(const char *msg, ...);
 
 #endif
 
+/**
+ * @deprecated Use MC_ERROR(), and return an appropriate error.
+ */
 #define MC_ABORT(x, ...) mc_abort(x, ##__VA_ARGS__)
 #define MC_ERROR(x, ...) mc_error(x, ##__VA_ARGS__)
 
index d62d54e4cc13dd3f6031c9635904201ecd89f5c6..cab2f1ec0fbe9ba65ff55a24335f81508b12be92 100644 (file)
@@ -73,7 +73,7 @@ struct json_object* json_object_from_file(const 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 opening file %s: %s\n",
             filename, strerror(errno));
     return NULL;
   }
@@ -87,7 +87,7 @@ struct json_object* json_object_from_file(const char *filename)
   }
   close(fd);
   if(ret < 0) {
-    MC_ABORT("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));
     printbuf_free(pb);
     return NULL;