Skip to content

Commit

Permalink
jwt_encode_fp: Reduce code to avoid uncovered lines
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Collins <[email protected]>
  • Loading branch information
benmcollins committed Jan 6, 2025
1 parent b4493f9 commit b511268
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions libjwt/jwt-encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,12 @@ static int jwt_encode(jwt_t *jwt, char **out)
int jwt_encode_fp(jwt_t *jwt, FILE *fp)
{
char_auto *str = NULL;
int ret;

ret = jwt_encode(jwt, &str);
if (ret)
return ret;

fputs(str, fp);
errno = jwt_encode(jwt, &str);
if (!errno)
fputs(str, fp);

return 0;
return errno;
}

char *jwt_encode_str(jwt_t *jwt)
Expand Down

0 comments on commit b511268

Please sign in to comment.