JSON_ENC: Minor tweaks

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22037)
This commit is contained in:
Hugo Landau 2024-01-22 14:45:00 +00:00
parent 613917ea0c
commit 39b9345234
3 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}