Skip to content

Unused assignment #4

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

Closed
Daniel-Cortez opened this issue Dec 4, 2019 · 3 comments
Closed

Unused assignment #4

Daniel-Cortez opened this issue Dec 4, 2019 · 3 comments

Comments

@Daniel-Cortez
Copy link

The following code in function stmt_close() looks suspicious:

// reset data.
gs_Statements[statement][E_STMT_MYSQL_HANDLE] = INVALID_CONNECTION;
statement = INVALID_STATEMENT;
return true;
}

The assignment statement = INVALID_STATEMENT; seems to be unused (statement is neither passed by reference nor a global variable). Was this intended?

@PatrickGTR
Copy link
Owner

Hello, sorry for a really long late reply. I just seen this.

iirc it is used to free up a statements. statements that requires one time use only, but another alternative is to bump up the value of MAX_STATEMENTS

@Daniel-Cortez
Copy link
Author

Daniel-Cortez commented Apr 9, 2020

iirc it is used to free up a statements. statements that requires one time use only

I didn't mean the whole function, I only meant the line statement = INVALID_STATEMENT; which seems to be redundant code, as the value assigned to statement on that line is unused upon return.
I discovered it with this new feature (currently pending approval).

@PatrickGTR
Copy link
Owner

PatrickGTR commented Apr 20, 2020

After reading, it makes sense! Thanks for bringing this up.

#4 #

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

No branches or pull requests

2 participants