Skip to content

Commit c82f5fd

Browse files
committed
.
1 parent 7ce48c9 commit c82f5fd

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/jwt_io.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pl_jwt_decode(term_t in, term_t out_payload, term_t out_algorithm, term_t in_key
4343
{
4444
char *input, *key, *payload;
4545
const char *algorithm;
46-
int jwt_result, retval1, retval2;
46+
int jwt_result;
4747
jwt_t *jwt;
4848

4949
get_pl_arg_str("jwt_encode_from_string/4", "in", in, &input);
@@ -56,16 +56,11 @@ pl_jwt_decode(term_t in, term_t out_payload, term_t out_algorithm, term_t in_key
5656
if (!jwt_result) {
5757
payload = jwt_get_grants_json(jwt, NULL);
5858
algorithm = jwt_alg_str(jwt_get_alg(jwt));
59-
retval1 = PL_unify_atom_chars(out_payload, payload);
60-
retval2 = PL_unify_atom_chars(out_algorithm, algorithm);
61-
if (retval1 != 0 && retval2 !=0) {
62-
free(payload);
63-
jwt_free(jwt);
64-
PL_succeed;
65-
} else {
66-
PL_warning("cannot decode jwt: %s %s", strerror(retval1), strerror(retval2));
67-
PL_fail;
68-
}
59+
(void) PL_unify_atom_chars(out_payload, payload);
60+
(void) PL_unify_atom_chars(out_algorithm, algorithm);
61+
free(payload);
62+
jwt_free(jwt);
63+
PL_succeed;
6964
} else {
7065
PL_warning("cannot decode jwt: %s", strerror(jwt_result));
7166
PL_fail;

0 commit comments

Comments
 (0)