]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Rename _set_last_err() to _json_c_set_last_err().
authorEric Haszlakiewicz <erh+git@nimenees.com>
Wed, 29 Nov 2017 14:25:11 +0000 (09:25 -0500)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Wed, 29 Nov 2017 14:36:53 +0000 (09:36 -0500)
json_object.c
json_object_private.h
json_util.c
json_util.h

index 08f9ac15e1482493ff366156f7fe341c925d4f26..6cec62fc808571910edb339c3f397e04daf4562e 100644 (file)
@@ -756,13 +756,13 @@ int json_c_set_serialization_double_format(const char *double_format, int global
                }
                tls_serialization_float_format = double_format ? strdup(double_format) : NULL;
 #else
-               _set_last_err("json_c_set_option: not compiled with __thread support\n");
+               _json_c_set_last_err("json_c_set_option: not compiled with __thread support\n");
                return -1;
 #endif
        }
        else
        {
-               _set_last_err("json_c_set_option: invalid global_or_thread value: %d\n", global_or_thread);
+               _json_c_set_last_err("json_c_set_option: invalid global_or_thread value: %d\n", global_or_thread);
                return -1;
        }
        return 0;
index 1fe10be2cd996000b487cde476a2a98f352944ee..325005a3fd7de3dd810a11c0d7131c9d00b12c3f 100644 (file)
@@ -48,7 +48,7 @@ struct json_object
   void *_userdata;
 };
 
-void _set_last_err(const char *err_fmt, ...);
+void _json_c_set_last_err(const char *err_fmt, ...);
 
 #ifdef __cplusplus
 }
index b5bcd07f1e868f971530ba4413975116ea0d5be6..ad7704a945881f420e58ec8a7dbf425f34850da3 100644 (file)
@@ -72,7 +72,7 @@ const char *json_util_get_last_err()
        return _last_err;
 }
 
-void _set_last_err(const char *err_fmt, ...)
+void _json_c_set_last_err(const char *err_fmt, ...)
 {
        va_list ap;
        va_start(ap, err_fmt);
@@ -89,14 +89,14 @@ struct json_object* json_object_from_fd(int fd)
   int ret;
 
   if(!(pb = printbuf_new())) {
-    _set_last_err("json_object_from_file: printbuf_new failed\n");
+    _json_c_set_last_err("json_object_from_file: printbuf_new failed\n");
     return NULL;
   }
   while((ret = read(fd, buf, JSON_FILE_BUF_SIZE)) > 0) {
     printbuf_memappend(pb, buf, ret);
   }
   if(ret < 0) {
-    _set_last_err("json_object_from_fd: error reading fd %d: %s\n", fd, strerror(errno));
+    _json_c_set_last_err("json_object_from_fd: error reading fd %d: %s\n", fd, strerror(errno));
     printbuf_free(pb);
     return NULL;
   }
@@ -111,7 +111,7 @@ struct json_object* json_object_from_file(const char *filename)
   int fd;
 
   if((fd = open(filename, O_RDONLY)) < 0) {
-    _set_last_err("json_object_from_file: error opening file %s: %s\n",
+    _json_c_set_last_err("json_object_from_file: error opening file %s: %s\n",
             filename, strerror(errno));
     return NULL;
   }
@@ -128,12 +128,12 @@ int json_object_to_file_ext(const char *filename, struct json_object *obj, int f
        int saved_errno;
 
        if (!obj) {
-               _set_last_err("json_object_to_file: object is null\n");
+               _json_c_set_last_err("json_object_to_file: object is null\n");
                return -1;
        }
 
        if ((fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0644)) < 0) {
-               _set_last_err("json_object_to_file: error opening file %s: %s\n",
+               _json_c_set_last_err("json_object_to_file: error opening file %s: %s\n",
                              filename, strerror(errno));
                return -1;
        }
@@ -147,7 +147,7 @@ int json_object_to_file_ext(const char *filename, struct json_object *obj, int f
 int json_object_to_fd(int fd, struct json_object *obj, int flags)
 {
        if (!obj) {
-               _set_last_err("json_object_to_fd: object is null\n");
+               _json_c_set_last_err("json_object_to_fd: object is null\n");
                return -1;
        }
 
@@ -169,7 +169,7 @@ static int _json_object_to_fd(int fd, struct json_object *obj, int flags, const
        wpos = 0;
        while(wpos < wsize) {
                if((ret = write(fd, json_str + wpos, wsize-wpos)) < 0) {
-                 _set_last_err("json_object_to_file: error writing file %s: %s\n",
+                 _json_c_set_last_err("json_object_to_file: error writing file %s: %s\n",
                         filename, strerror(errno));
                  return -1;
                }
@@ -235,7 +235,7 @@ const char *json_type_to_name(enum json_type o_type)
        int o_type_int = (int)o_type;
        if (o_type_int < 0 || o_type_int >= (int)NELEM(json_type_name))
        {
-               _set_last_err("json_type_to_name: type %d is out of range [0,%d]\n", o_type, NELEM(json_type_name));
+               _json_c_set_last_err("json_type_to_name: type %d is out of range [0,%d]\n", o_type, NELEM(json_type_name));
                return NULL;
        }
        return json_type_name[o_type];
index d8926db9db09c128ff2869057202cc8a50b9c836..8f9fe8b8086d5abb9e7cb7c03a61ef9203abb658 100644 (file)
@@ -77,8 +77,8 @@ extern int json_object_to_file_ext(const char *filename, struct json_object *obj
 extern int json_object_to_fd(int fd, struct json_object *obj, int flags);
 
 /**
- * Return the last error from json_object_to_file{,_ext},
- * json_object_to_fd() or
+ * Return the last error from various json-c functions, including:
+ * json_object_to_file{,_ext}, json_object_to_fd() or
  * json_object_from_{file,fd}, or NULL if there is none.
  */
 const char *json_util_get_last_err(void);