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

Refactor: remove TBuffer::processSocketData(char*, int) #3830

Conversation

SlySven
Copy link
Member

@SlySven SlySven commented May 25, 2020

It really wasn't useful - it just refactored out some lines of code into a separate method for the cost of another function call...

Also fix a dodgy argument of the form (char*&) which was passing a char array anyhow.

A line mpHost->mInsertedMissingLF = false; is taken out by this PR but that member is never used and will be removed in another PR to be entered after this one.

Signed-off-by: Stephen Lyons slysven@virginmedia.com

It really wasn't useful - it just refactored out some lines of code into
a separate method for the cost of another function call...

Also fix a dodgy argument of the form (char*&) which was passing a char
array anyhow.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven requested review from a team as code owners May 25, 2020 20:36
@add-deployment-links
Copy link

add-deployment-links bot commented May 25, 2020

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@Kebap
Copy link
Contributor

Kebap commented May 25, 2020

Refactor: remove TBuffer::processSocketData(char*, int)
It really wasn't useful - it just refactored out some lines of code into a separate method for the cost of another function call...

Actually looking at the code (not through it, can't be bothered), processSocketData is a massive bowl of spaghetti code still, which certainly warrants some refactorization - Whereas the not really useful function with 10 lines of code was called handle_socket_signal_readyRead - and still is, as it has now inherited ~170 lines from the aforementioned function.

I for one am not sure what the cost of another function call is, and would vote for having multiple small and indeed digestable functions rather. Not sure what is really gained here by attaching these 2 functions together into 1.

A line mpHost->mInsertedMissingLF = false; is taken out by this PR but that member is never used and will be removed in another PR to be entered after this one.

I like the idea of splitting changes into smaller PRs for easy review, but these items should still be linked in the same.

@SlySven
Copy link
Member Author

SlySven commented May 25, 2020

As it happened I spotted these things whilst I was focussing on another aspect and I tried to extract each thing separately. I wasn't entirely successful and had to re add taking that line out in the other one so it would compile separately.

I hadn't paid attention to the history of how the (slot method as it happens) handle_socket_signal_readyRead() and processSocketData(...) came about - but it seems that @vadi2 put the latter in in PR #2337 "Refactor telnet socket read for unit testing / fuzzing". So it seems I have just reverted a change made about 20 months ago.

That being the case I will close this as it is not going in the direction we want to go.

@SlySven SlySven closed this May 25, 2020
@vadi2
Copy link
Member

vadi2 commented May 26, 2020

Have to agree with Kebap - many small functions with a clear purpose are better than one humongous one.

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.

None yet

3 participants