]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ossl_json_f64() seems to be unused, remove it to avoid libm dependency
authorsashan <anedvedicky@gmail.com>
Fri, 18 Apr 2025 10:09:52 +0000 (12:09 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 29 Apr 2025 17:38:27 +0000 (19:38 +0200)
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27434)

include/internal/json_enc.h
ssl/quic/json_enc.c
test/json_test.c

index e7d9a6d922e7cb6a8a443cd82136ff180da99218..c2e82720286bcd7106e140869d75d74c36710b2f 100644 (file)
@@ -202,9 +202,6 @@ void ossl_json_u64(OSSL_JSON_ENC *json, uint64_t value);
 /* Encode a JSON integer from an int64_t. */
 void ossl_json_i64(OSSL_JSON_ENC *json, int64_t value);
 
-/* Encode a JSON number from a 64-bit floating point value. */
-void ossl_json_f64(OSSL_JSON_ENC *json, double value);
-
 /*
  * Encode a JSON UTF-8 string from a zero-terminated string. The string passed
  * can be freed immediately following the call to this function.
index 3e9f715dfaca7d820b8a733655e8c5ff1506cb31..1d1e17b7525ce0d652ce6659e2ae898ee0d969a9 100644 (file)
@@ -11,7 +11,6 @@
 #include "internal/nelem.h"
 #include "internal/numbers.h"
 #include <string.h>
-#include <math.h>
 
 /*
  * wbuf
@@ -595,33 +594,6 @@ void ossl_json_i64(OSSL_JSON_ENC *json, int64_t value)
         json_write_char(json, '"');
 }
 
-/* Encode a JSON number from a 64-bit floating point value. */
-void ossl_json_f64(OSSL_JSON_ENC *json, double value)
-{
-    char buf[32];
-
-    if (!json_pre_item(json))
-        return;
-
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    {
-        int checks = isnan(value);
-# if !defined(OPENSSL_SYS_VMS)
-        checks |= isinf(value);
-# endif
-
-        if (checks) {
-            json_raise_error(json);
-            return;
-        }
-    }
-#endif
-
-    BIO_snprintf(buf, sizeof(buf), "%1.17g", value);
-    json_write_str(json, buf);
-    json_post_item(json);
-}
-
 /*
  * Encode a JSON UTF-8 string from a zero-terminated string. The string passed
  * can be freed immediately following the call to this function.
index 33d9522dd07b6429256f44d897b1730a78e71db0..6372f1beb50c3c2aab7913f489535c31f67fe7ee 100644 (file)
@@ -119,7 +119,6 @@ typedef void (*fp_pz_type)(OSSL_JSON_ENC *, const void *, size_t);
 #define OPJ_BOOL(x)           OP_CALL_I(ossl_json_bool, (x))
 #define OPJ_U64(x)            OP_CALL_U64(ossl_json_u64, (x))
 #define OPJ_I64(x)            OP_CALL_I64(ossl_json_i64, (x))
-#define OPJ_F64(x)            OP_CALL_D(ossl_json_f64, (x))
 #define OPJ_KEY(x)            OP_CALL_P(ossl_json_key, (x))
 #define OPJ_STR(x)            OP_CALL_P(ossl_json_str, (x))
 #define OPJ_STR_LEN(x, xl)    OP_CALL_PZ(ossl_json_str_len, (x), (xl))