Skip to content

(WIP) Remove compat snprintf() and vsnprintf() (eggdrop requires posix 2001) - #1028

Open
michaelortmann wants to merge 4 commits into
eggheads:developfrom
michaelortmann:snprintfposix
Open

michaelortmann wants to merge 4 commits into
eggheads:developfrom
michaelortmann:snprintfposix

Conversation

@michaelortmann

@michaelortmann michaelortmann commented Sep 12, 2020 •

Copy link
Copy Markdown
Member

Found by: vanosg
Patch by: michaelortmann
Fixes: #226

One-line summary:
Eggdrop depends on POSIX.1-2001. POSIX.1-2001 defines snprintf() and vsnprintf(). This patch gets rid of src/compat/snprintf*. egg_snprintf() and egg_vsnprintf() are left as is, but redefined to directly use snprintf() and vsnprintf() with a one-liner define in eggdrop.h. we only keep egg_snprintf() and egg_vsnprintf() for backward compatibility to (older) modules, and could remove it from later eggdrop versions when api breakage becomes possible.

All egg_snprintf() and egg_vsnprintf() were replaced by snprintf() and vsnprintf():

find ./ -type f -exec sed -i 's/egg_snprintf(/snprintf(/g' {} \;
find ./ -type f -exec sed -i 's/egg_vsnprintf(/vsnprintf(/g' {} \;

Note: don't do this in git directory. cd src/ first!

With this PR you must run misc/runautotools and misc/makedepend.

To help with reviewing, i separated the "mass replace with find" into commit d8586f4, everything else i put into commit 9c44751.

This PR is still WIP, because switching to directly using snprintf() helps the compiler analyzing the code and reporting back more warnings. Now i want to check those warning, maybe fix those within this PR. Those compiler warnings are not about new code, or something off with this PR, the code was always there and the same, but compiler warnings were shadowed by our egg_snprintf() magick and now we get to finally see them in all their glory.

Le me know, if you want
(1) me to fix all new compiler warnings within this PR before merging this
(2) me to fix all new compiler warnings in separate PRs, that will look like #1029, before merging this
(3) to merge this PR now (and fix the compiler warnings later)
(4) me to be king of the day again ;)

Additional description (if needed):

Test cases demonstrating functionality (if applicable):

…rt egg_snprintf() and egg_vsnprintf() for backward compatibility
This was referenced Oct 5, 2020
michaelortmann added a commit to michaelortmann/eggdrop that referenced this pull request Oct 6, 2020
@michaelortmann

Copy link
Copy Markdown
Member Author

This PR was big, so it should be done in 2 parts instead. part 1 is PR #1523 cleaning up (egg_)vsnprintf(), part 2 is to be done cleaning up (egg_)snprintf(). Then we should start fixing the prototypes, see #1940.

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.

Update non-needed compat code

1 participant