Skip to content

Conversation

@saghul
Copy link

@saghul saghul commented Dec 2, 2025

In static builds, symbol collisions are possible since the functions are named the same.


Hey there, thank a lot for your library!

I ran intro this because I'm already using aklomp/base64 in a C++ application where a lot of base64 encoding is taking place, and recently added your library as a static library.

Copy link
Owner

@benmcollins benmcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch. I wonder if it's worth moving base64.c into jwt.c where that is the only place it's used and make the functions static.

The fewer places where things are exported that aren't meant to be pubic interfaces, the better.

libjwt/base64.h Outdated
extern unsigned int base64_encode(const unsigned char *in, unsigned int inlen,
char *out);
extern unsigned int jwt_base64_encode(const unsigned char *in,
unsigned int inlen, char *out);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the second line of the declaration (and similarly on the one below) align with the first paren on the first line (tabs are 8 spaces).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the second line of the declaration (and similarly on the one below) align with the first paren on the first line (tabs are 8 spaces).

I think I got it right now. 😅

@saghul saghul force-pushed the b64-symbol-rename branch from b23dc4d to 2f98d1f Compare December 2, 2025 16:51
@saghul
Copy link
Author

saghul commented Dec 2, 2025

Thank you for the patch. I wonder if it's worth moving base64.c into jwt.c where that is the only place it's used and make the functions static.

The fewer places where things are exported that aren't meant to be pubic interfaces, the better.

Yep, that would certainly help here! Happy to move the code around if you want.

@benmcollins
Copy link
Owner

Yep, that would certainly help here! Happy to move the code around if you want.

That would be very much appreciated. Thanks!

In static builds, symbol collisions are possible since the functions are
named the same.

Embed the base64 library in the only file where it's used and make all
its functions static.
@saghul saghul force-pushed the b64-symbol-rename branch from 2f98d1f to 859ce12 Compare December 2, 2025 21:16
@saghul
Copy link
Author

saghul commented Dec 2, 2025

Done, moved it all to jwt.c!

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.73%. Comparing base (91fa41a) to head (859ce12).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #235      +/-   ##
==========================================
+ Coverage   99.68%   99.73%   +0.05%     
==========================================
  Files          15       14       -1     
  Lines        1902     1902              
==========================================
+ Hits         1896     1897       +1     
+ Misses          6        5       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants