]> granicus.if.org Git - json-c/commitdiff
Make json_abort() internal to json_object.c
authorEric Haszlakiewicz <erh+git@nimenees.com>
Sat, 18 Apr 2020 02:05:37 +0000 (02:05 +0000)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Sat, 18 Apr 2020 02:05:37 +0000 (02:05 +0000)
json_object.c
json_util.c
json_util.h

index e65ea042bd4a8627e6373a6515ce8ec058486f22..3527afebd0ecfc38a43e7f39a6f4cf36c0abc3aa 100644 (file)
@@ -55,6 +55,24 @@ static json_object_to_json_string_fn json_object_string_to_json_string;
 static json_object_to_json_string_fn json_object_array_to_json_string;
 static json_object_to_json_string_fn _json_object_userdata_to_json_string;
 
+#ifndef JSON_NORETURN
+#if defined(_MSC_VER)
+#define JSON_NORETURN __declspec(noreturn)
+#else
+/* 'cold' attribute is for optimization, telling the computer this code
+ * path is unlikely.
+ */
+#define JSON_NORETURN __attribute__((noreturn, cold))
+#endif
+#endif
+/**
+ * Abort and optionally print a message on standard error.
+ * This should be used rather than assert() for unconditional abortion
+ * (in particular for code paths which are never supposed to be run).
+ * */
+JSON_NORETURN static void json_abort(const char *message);
+
+
 /* ref count debugging */
 
 #ifdef REFCOUNT_DEBUG
@@ -1631,3 +1649,10 @@ int json_object_deep_copy(struct json_object *src, struct json_object **dst,
 
        return rc;
 }
+
+static void json_abort(const char *message)
+{
+       if (message != NULL)
+               fprintf(stderr, "json-c aborts with error: %s\n", message);
+       abort();
+}
index 24dd7686e8b71899cbe4aaa26904ca3b127d5f45..12e33bb77c065f04cee4f29179ddccd7d5af0bef 100644 (file)
@@ -297,9 +297,3 @@ const char *json_type_to_name(enum json_type o_type)
        return json_type_name[o_type];
 }
 
-void json_abort(const char *message)
-{
-       if (message != NULL)
-               fprintf(stderr, "json-c aborts with error: %s\n", message);
-       abort();
-}
index 0a83d99f464855f4b2ddab3a7f4e4a0faf692d7c..2a4b6c19bd3494c8ede16aabad7e6d1261cce8ce 100644 (file)
@@ -110,23 +110,6 @@ JSON_EXPORT int json_parse_double(const char *buf, double *retval);
  */
 JSON_EXPORT const char *json_type_to_name(enum json_type o_type);
 
-#ifndef JSON_NORETURN
-#if defined(_MSC_VER)
-#define JSON_NORETURN __declspec(noreturn)
-#else
-/* 'cold' attribute is for optimization, telling the computer this code
- * path is unlikely.
- */
-#define JSON_NORETURN __attribute__((noreturn, cold))
-#endif
-#endif
-/**
- * Abort and optionally print a message on standard error.
- * This should be used rather than assert() for unconditional abortion
- * (in particular for code paths which are never supposed to be run).
- * */
-JSON_NORETURN JSON_EXPORT void json_abort(const char *message);
-
 #ifdef __cplusplus
 }
 #endif