Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup irc.mod / string copy #1134

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

michaelortmann
Copy link
Member

Found by: michaelortmann
Patch by: michaelortmann
Fixes:

One-line summary:
Cleanup irc.mod / string copy

Additional description (if needed):
Some got-functions in chan.c and irc.mod did an unnecessary string copy.

Test cases demonstrating functionality (if applicable):
No functional change.

@thommey
Copy link
Member

thommey commented Aug 22, 2021

This isn't a simple cleanup, it's a change in behavior. newsplit modifies its argument string to split it, removing this buffer makes the functions modify the input.

@michaelortmann
Copy link
Member Author

thats fine. the parameter is modifyable. we dont need to copy before newsplit(). other functions in chan.c call newsplit() on the parameter without such copy also. example: https://github.com/eggheads/eggdrop/blob/develop/src/mod/irc.mod/chan.c#L1192

@thommey
Copy link
Member

thommey commented Aug 13, 2023

It still has side-effects I have seen in the past, e.g. raw console log being mangled.
It might be warranted to always give the bind handler a copy of this string instead of the real raw string.

…/develop' into simplify

Merge done to trigger new CI run
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