Skip to content

Commit 9f60075

Browse files
blemouzynashif
authored andcommitted
jwt: remove jwt_payload_len function
The function jwt_payload_len doesn't return payload length but returns used data in builder->buf If jwt_payload_len is called after jwt_init_builder, header length will be returned If jwt_payload_len is called after jwt_add_payload, header+payload length will be returned If jwt_payload_len is called after jwt_sign, header+payload+sign length will be returned So, this commit removes the function and uses strlen instead Signed-off-by: Benjamin Lemouzy <[email protected]>
1 parent 64ecbea commit 9f60075

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

include/zephyr/data/jwt.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ int jwt_sign(struct jwt_builder *builder,
110110
const char *der_key,
111111
size_t der_key_len);
112112

113-
114-
static inline size_t jwt_payload_len(struct jwt_builder *builder)
115-
{
116-
return (builder->buf - builder->base);
117-
}
118-
119113
#ifdef __cplusplus
120114
}
121115
#endif

tests/subsys/jwt/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ZTEST(jwt_tests, test_jwt)
5050
zassert_equal(build.overflowed, false, "Not overflow");
5151

5252
printk("JWT:\n%s\n", buf);
53-
printk("len: %zd\n", jwt_payload_len(&build));
53+
printk("len: %zd\n", strlen(buf));
5454
}
5555

5656
ZTEST_SUITE(jwt_tests, NULL, NULL, NULL, NULL, NULL);

0 commit comments

Comments
 (0)