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

*.c: Localize variables #92

Merged
merged 2 commits into from
Oct 18, 2023
Merged

Conversation

schwehr
Copy link
Member

@schwehr schwehr commented Oct 16, 2023

  • Move local variables closer to where they are use
  • Combine definition and initialization when possible
  • Add const when possible.

Skipped cases that were not immediately obvious.

- Move local variables closer to where they are use
- Combine definition and initialization when possible
- Add const when possible.

Skipped cases that were not immediately obvious.
@schwehr
Copy link
Member Author

schwehr commented Oct 16, 2023

The Mac osx build:

../../bin/makegeo.c:29:6: error: variable 'gtif' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
        if (!tif) goto failure;
            ^~~~
../../bin/makegeo.c:50:6: note: uninitialized use occurs here
        if (gtif) GTIFFree(gtif);
            ^~~~
../../bin/makegeo.c:29:2: note: remove the 'if' if its condition is always false
        if (!tif) goto failure;
        ^~~~~~~~~~~~~~~~~~~~~~
../../bin/makegeo.c:31:2: note: variable 'gtif' is declared here
        GTIF *gtif = GTIFNew(tif);  /* GeoKey-level descriptor */
        ^

@rouault rouault merged commit 3362ffd into OSGeo:master Oct 18, 2023
2 checks passed
@schwehr schwehr deleted the localize-local-variables branch October 19, 2023 16:10
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.

2 participants