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

cherry-picking from #114 Pvs analyze part 2 #215

Merged
merged 6 commits into from
Nov 28, 2018

Conversation

p-alik
Copy link
Collaborator

@p-alik p-alik commented Nov 27, 2018

please, review.

- use nullptr instead of NULL
- uniform initialisation
@esabol
Copy link
Member

esabol commented Nov 27, 2018

Use curly brace initialization style in libgearman-server/struct/gearmand.h lines 53-56?

server_thread{},
id{},
lock{}
//TODO uniform initialisation doesn't help with wakeup_event
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this TODO?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I can't remember.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should remove it then.

@@ -75,7 +74,7 @@ struct gearmand_st

void keepalive_idle(int keepalive_idle_)
{
_keepalive= true;
keepalive(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is _keepalive= true bad coding style according to PVS? It should be more efficient than keepalive(1) unless the compiler can optimize it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the commit with the changes is removed

@esabol
Copy link
Member

esabol commented Nov 27, 2018

Should libgearman-server/struct/thread.h line 64 have curly braces after lock?

Copy link
Member

@SpamapS SpamapS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something we can turn on after these changes to make sure we don't backslide?

@SpamapS SpamapS merged commit b98ae93 into gearman:master Nov 28, 2018
@p-alik
Copy link
Collaborator Author

p-alik commented Nov 28, 2018

Should libgearman-server/struct/thread.h line 64 have curly braces after lock?

I guess the compiler disliked pthread_mutex_t lock{}. But g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609 accepts braces.

@p-alik
Copy link
Collaborator Author

p-alik commented Nov 28, 2018

Is there something we can turn on after these changes to make sure we don't backslide?

Improving of test coverage could help, I think.

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.

3 participants