From: Hugo Landau Date: Mon, 22 Jan 2024 14:45:00 +0000 (+0000) Subject: JSON_ENC: Minor tweaks X-Git-Tag: openssl-3.3.0-alpha1~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39b9345234aacfcf5dbdf4ec5afc14bf0c6d9d2e;p=thirdparty%2Fopenssl.git JSON_ENC: Minor tweaks Reviewed-by: Matt Caswell Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/22037) --- diff --git a/include/internal/json_enc.h b/include/internal/json_enc.h index 9c13d0622d6..96ea920641b 100644 --- a/include/internal/json_enc.h +++ b/include/internal/json_enc.h @@ -117,12 +117,12 @@ int ossl_json_flush(OSSL_JSON_ENC *json); int ossl_json_flush_cleanup(OSSL_JSON_ENC *json); /* - * ossl_json_set_sink - * ------------------ + * ossl_json_set0_sink + * ------------------- * * Changes the sink used by the JSON encoder. */ -int ossl_json_set_sink(OSSL_JSON_ENC *json, BIO *bio); +int ossl_json_set0_sink(OSSL_JSON_ENC *json, BIO *bio); /* * ossl_json_in_error diff --git a/ssl/quic/json_enc.c b/ssl/quic/json_enc.c index f2c6f444e67..e5cf50066f6 100644 --- a/ssl/quic/json_enc.c +++ b/ssl/quic/json_enc.c @@ -37,7 +37,7 @@ static void wbuf_cleanup(struct json_write_buf *wbuf) wbuf->alloc = 0; } -static void wbuf_set_bio(struct json_write_buf *wbuf, BIO *bio) +static void wbuf_set0_bio(struct json_write_buf *wbuf, BIO *bio) { wbuf->bio = bio; } @@ -238,7 +238,7 @@ int ossl_json_init(OSSL_JSON_ENC *json, BIO *bio, uint32_t flags) return 0; json->state = STATE_PRE_COMMA; - return ossl_json_reset(json); + return 1; } void ossl_json_cleanup(OSSL_JSON_ENC *json) @@ -273,9 +273,9 @@ int ossl_json_flush(OSSL_JSON_ENC *json) return wbuf_flush(&json->wbuf); } -int ossl_json_set_sink(OSSL_JSON_ENC *json, BIO *bio) +int ossl_json_set0_sink(OSSL_JSON_ENC *json, BIO *bio) { - wbuf_set_bio(&json->wbuf, bio); + wbuf_set0_bio(&json->wbuf, bio); return 1; } diff --git a/ssl/quic/qlog.c b/ssl/quic/qlog.c index 6cf89e35544..82da15f5d12 100644 --- a/ssl/quic/qlog.c +++ b/ssl/quic/qlog.c @@ -174,7 +174,7 @@ int ossl_qlog_set_sink_bio(QLOG *qlog, BIO *bio) ossl_qlog_flush(qlog); /* best effort */ BIO_free_all(qlog->bio); qlog->bio = bio; - ossl_json_set_sink(&qlog->json, bio); + ossl_json_set0_sink(&qlog->json, bio); return 1; }