From 0e418628998d0337599643c1e4054c60e5f21ec4 Mon Sep 17 00:00:00 2001 From: sashan Date: Fri, 18 Apr 2025 12:09:52 +0200 Subject: [PATCH] ossl_json_f64() seems to be unused, remove it to avoid libm dependency Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27434) --- include/internal/json_enc.h | 3 --- ssl/quic/json_enc.c | 28 ---------------------------- test/json_test.c | 1 - 3 files changed, 32 deletions(-) diff --git a/include/internal/json_enc.h b/include/internal/json_enc.h index e7d9a6d922e..c2e82720286 100644 --- a/include/internal/json_enc.h +++ b/include/internal/json_enc.h @@ -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. diff --git a/ssl/quic/json_enc.c b/ssl/quic/json_enc.c index 3e9f715dfac..1d1e17b7525 100644 --- a/ssl/quic/json_enc.c +++ b/ssl/quic/json_enc.c @@ -11,7 +11,6 @@ #include "internal/nelem.h" #include "internal/numbers.h" #include -#include /* * 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. diff --git a/test/json_test.c b/test/json_test.c index 33d9522dd07..6372f1beb50 100644 --- a/test/json_test.c +++ b/test/json_test.c @@ -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)) -- 2.47.2