-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Fix unused variable warning #7393
Conversation
lib/vtls/mbedtls_threadlock.c
Outdated
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H) | ||
int ret; | ||
ret = pthread_mutex_init(&mutex_buf[i], NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍, nice catch. It does beg the question though, shouldn't we just shorten it to:
if (pthread_mutex_init(&mutex_buf[i], NULL))
return 0;
..to increase readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency it would then be nice to eliminate all the ret variables in the file as none of them is used besides for checking call result. Should I update the pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency it would then be nice to eliminate all the ret variables in the file as none of them is used besides for checking call result. Should I update the pull request?
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be great, let's see what that changeset would look like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the pull request with the suggested changes
Update mbedtls_threadlock.c
3ea62d6
to
60d655e
Compare
Thanks! |
Variable ret is only used in case of USE_THREADS_POSIX. Other cases will issue a warning about unused variable.