-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix C4703 uninitialized pointer variable warnings #7154
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
base: main
Are you sure you want to change the base?
Conversation
src/util/net.c
Outdated
| const char *authority, | ||
| size_t len) | ||
| { | ||
| const char *c, *hostport_end, *host_end = 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.
Why do only some of these need an individual = NULL and not others? You've added one for userpass_end but c and hostport_end still don't have one.
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.
It's up to the compiler to look at usage after this and whether or not it will get deterministically assigned versus for others. I can get these as well just for consistency versus only fixing ones that /SDL asked for given the usage afterwards.
src/util/net.c
Outdated
| { | ||
| git_net_url_parser parser = GIT_NET_URL_PARSER_INIT; | ||
| const char *c, *authority, *path = NULL; | ||
| const char *c, *authority = NULL, *path = 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.
Similar, why does authority need it but not c?
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 suspect more warnings will pop up since there are still uninitialized variables, but what's there is fine.
Addresses C4703 uninitialized variables warnings that promote to errors with /sdl flag
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4703?view=msvc-170