Skip to content

Commit 6d15da7

Browse files
committed
apr_jose: Change the signature of apr_jose_make() so that it is no
longer neceessary to pass in a pointer to a NULL pointer, but keep supporting the option to pre-allocate structures. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1839859 13f79535-47bb-0310-9956-ffa450edef68
1 parent ee50e50 commit 6d15da7

File tree

4 files changed

+271
-267
lines changed

4 files changed

+271
-267
lines changed

include/apr_jose.h

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,9 @@ APR_DECLARE(apu_err_t *) apr_jose_error(apr_jose_t *jose);
923923
* be reused.
924924
* @param type the type of structure to create.
925925
* @param pool pool used to allocate the result from.
926+
* @return The apr_jose_t is returned.
926927
*/
927-
APR_DECLARE(apr_status_t) apr_jose_make(apr_jose_t **jose, apr_jose_type_e type,
928+
APR_DECLARE(apr_jose_t *) apr_jose_make(apr_jose_t *jose, apr_jose_type_e type,
928929
apr_pool_t *pool);
929930

930931
/**
@@ -934,8 +935,9 @@ APR_DECLARE(apr_status_t) apr_jose_make(apr_jose_t **jose, apr_jose_type_e type,
934935
* be reused.
935936
* @param key the json representing the key. May be NULL.
936937
* @param pool pool used to allocate the result from.
938+
* @return The apr_jose_t is returned.
937939
*/
938-
APR_DECLARE(apr_status_t) apr_jose_jwk_make(apr_jose_t **jose,
940+
APR_DECLARE(apr_jose_t *) apr_jose_jwk_make(apr_jose_t *jose,
939941
apr_json_value_t *key, apr_pool_t *pool);
940942

941943
/**
@@ -945,8 +947,9 @@ APR_DECLARE(apr_status_t) apr_jose_jwk_make(apr_jose_t **jose,
945947
* be reused.
946948
* @param keys the array of keys in JSON format. May be NULL.
947949
* @param pool pool used to allocate the result from.
950+
* @return The apr_jose_t is returned.
948951
*/
949-
APR_DECLARE(apr_status_t) apr_jose_jwks_make(apr_jose_t **jose,
952+
APR_DECLARE(apr_jose_t *) apr_jose_jwks_make(apr_jose_t *jose,
950953
apr_json_value_t *keys, apr_pool_t *pool);
951954

952955
/**
@@ -956,9 +959,10 @@ APR_DECLARE(apr_status_t) apr_jose_jwks_make(apr_jose_t **jose,
956959
* @param header the unprotected header.
957960
* @param protected the protected header.
958961
* @param pool the pool to use.
962+
* @return The apr_jose_signature_t is returned.
959963
*/
960-
APR_DECLARE(apr_status_t) apr_jose_signature_make(
961-
apr_jose_signature_t **signature, apr_json_value_t *header,
964+
APR_DECLARE(apr_jose_signature_t *) apr_jose_signature_make(
965+
apr_jose_signature_t *signature, apr_json_value_t *header,
962966
apr_json_value_t *protected, apr_pool_t *pool);
963967

964968
/**
@@ -967,8 +971,9 @@ APR_DECLARE(apr_status_t) apr_jose_signature_make(
967971
* @param recipient the result.
968972
* @param unprotected the unprotected header.
969973
* @param pool the pool to use.
974+
* @return The apr_jose_recipient_t is returned.
970975
*/
971-
APR_DECLARE(apr_status_t) apr_jose_recipient_make(apr_jose_recipient_t **recipient,
976+
APR_DECLARE(apr_jose_recipient_t *) apr_jose_recipient_make(apr_jose_recipient_t *recipient,
972977
apr_json_value_t *unprotected, apr_pool_t *pool);
973978

974979
/**
@@ -978,8 +983,9 @@ APR_DECLARE(apr_status_t) apr_jose_recipient_make(apr_jose_recipient_t **recipie
978983
* @param unprotected the unprotected shared header.
979984
* @param protected the protected header.
980985
* @param pool the pool to use.
986+
* @return The apr_jose_encryption_t is returned.
981987
*/
982-
APR_DECLARE(apr_status_t) apr_jose_encryption_make(apr_jose_encryption_t **encryption,
988+
APR_DECLARE(apr_jose_encryption_t *) apr_jose_encryption_make(apr_jose_encryption_t *encryption,
983989
apr_json_value_t *unprotected, apr_json_value_t *protected,
984990
apr_pool_t *pool);
985991

@@ -993,8 +999,9 @@ APR_DECLARE(apr_status_t) apr_jose_encryption_make(apr_jose_encryption_t **encry
993999
* @param encryption the encryption structure.
9941000
* @param payload the JOSE payload to encrypt.
9951001
* @param pool pool used to allocate the result from.
1002+
* @return The apr_jose_t is returned.
9961003
*/
997-
APR_DECLARE(apr_status_t) apr_jose_jwe_make(apr_jose_t **jose,
1004+
APR_DECLARE(apr_jose_t *) apr_jose_jwe_make(apr_jose_t *jose,
9981005
apr_jose_recipient_t *recipient, apr_array_header_t *recipients,
9991006
apr_jose_encryption_t *encryption, apr_jose_t *payload,
10001007
apr_pool_t *pool);
@@ -1009,8 +1016,9 @@ APR_DECLARE(apr_status_t) apr_jose_jwe_make(apr_jose_t **jose,
10091016
* @param encryption the encryption structure.
10101017
* @param payload the JOSE payload to encrypt.
10111018
* @param pool pool used to allocate the result from.
1019+
* @return The apr_jose_t is returned.
10121020
*/
1013-
APR_DECLARE(apr_status_t) apr_jose_jwe_json_make(apr_jose_t **jose,
1021+
APR_DECLARE(apr_jose_t *) apr_jose_jwe_json_make(apr_jose_t *jose,
10141022
apr_jose_recipient_t *recipient,
10151023
apr_array_header_t *recipients, apr_jose_encryption_t *encryption,
10161024
apr_jose_t *payload, apr_pool_t *pool);
@@ -1024,8 +1032,9 @@ APR_DECLARE(apr_status_t) apr_jose_jwe_json_make(apr_jose_t **jose,
10241032
* @param signatures array of header / protected header / signature used with general JSON syntax.
10251033
* @param payload the payload to be wrapped by this JWS.
10261034
* @param pool pool used to allocate the result from.
1035+
* @return The apr_jose_t is returned.
10271036
*/
1028-
APR_DECLARE(apr_status_t) apr_jose_jws_make(apr_jose_t **jose,
1037+
APR_DECLARE(apr_jose_t *) apr_jose_jws_make(apr_jose_t *jose,
10291038
apr_jose_signature_t *signature, apr_array_header_t *signatures,
10301039
apr_jose_t *payload, apr_pool_t *pool);
10311040

@@ -1038,8 +1047,9 @@ APR_DECLARE(apr_status_t) apr_jose_jws_make(apr_jose_t **jose,
10381047
* @param signatures array of header / protected header / signature used with general JSON syntax.
10391048
* @param payload the payload to be wrapped by this JWS.
10401049
* @param pool pool used to allocate the result from.
1050+
* @return The apr_jose_t is returned.
10411051
*/
1042-
APR_DECLARE(apr_status_t) apr_jose_jws_json_make(apr_jose_t **jose,
1052+
APR_DECLARE(apr_jose_t *) apr_jose_jws_json_make(apr_jose_t *jose,
10431053
apr_jose_signature_t *signature, apr_array_header_t *signatures,
10441054
apr_jose_t *payload, apr_pool_t *pool);
10451055

@@ -1053,8 +1063,9 @@ APR_DECLARE(apr_status_t) apr_jose_jws_json_make(apr_jose_t **jose,
10531063
* be reused.
10541064
* @param claims the claims to sign.
10551065
* @param pool pool used to allocate the result from.
1066+
* @return The apr_jose_t is returned.
10561067
*/
1057-
APR_DECLARE(apr_status_t) apr_jose_jwt_make(apr_jose_t **jose,
1068+
APR_DECLARE(apr_jose_t *) apr_jose_jwt_make(apr_jose_t *jose,
10581069
apr_json_value_t *claims, apr_pool_t *pool);
10591070

10601071
/**
@@ -1066,8 +1077,9 @@ APR_DECLARE(apr_status_t) apr_jose_jwt_make(apr_jose_t **jose,
10661077
* @param in the plaintext to sign.
10671078
* @param inlen length of the plaintext.
10681079
* @param pool pool used to allocate the result from.
1080+
* @return The apr_jose_t is returned.
10691081
*/
1070-
APR_DECLARE(apr_status_t) apr_jose_data_make(apr_jose_t **jose, const char *typ,
1082+
APR_DECLARE(apr_jose_t *) apr_jose_data_make(apr_jose_t *jose, const char *typ,
10711083
const unsigned char *in, apr_size_t inlen, apr_pool_t *pool);
10721084

10731085
/**
@@ -1080,8 +1092,9 @@ APR_DECLARE(apr_status_t) apr_jose_data_make(apr_jose_t **jose, const char *typ,
10801092
* @param in the UTF-8 encoded text string.
10811093
* @param inlen length of the UTF-8 encoded text string.
10821094
* @param pool pool used to allocate the result from.
1095+
* @return The apr_jose_t is returned.
10831096
*/
1084-
APR_DECLARE(apr_status_t) apr_jose_text_make(apr_jose_t **jose, const char *cty,
1097+
APR_DECLARE(apr_jose_t *) apr_jose_text_make(apr_jose_t *jose, const char *cty,
10851098
const char *in, apr_size_t inlen, apr_pool_t *pool);
10861099

10871100
/**
@@ -1092,8 +1105,9 @@ APR_DECLARE(apr_status_t) apr_jose_text_make(apr_jose_t **jose, const char *cty,
10921105
* @param cty the content type.
10931106
* @param json the json object to add.
10941107
* @param pool pool used to allocate the result from.
1108+
* @return The apr_jose_t is returned.
10951109
*/
1096-
APR_DECLARE(apr_status_t) apr_jose_json_make(apr_jose_t **jose, const char *cty,
1110+
APR_DECLARE(apr_jose_t *) apr_jose_json_make(apr_jose_t *jose, const char *cty,
10971111
apr_json_value_t *json, apr_pool_t *pool);
10981112

10991113
/**

0 commit comments

Comments
 (0)