Add const qualifier for string parameters#626
Merged
mschoema merged 1 commit intoMobilityDB:masterfrom Oct 9, 2024
Merged
Conversation
mschoema
approved these changes
Oct 9, 2024
mschoema
reviewed
Oct 9, 2024
| tmp += 5; | ||
| /* Parse out the SRID number */ | ||
| srid = atoi(tmp); | ||
| pfree(tmp); |
Member
There was a problem hiding this comment.
Apparently calling pfree(tmp) after having done tmp += 5 produces the following warning:
/home/maxime/Documents/phd/code/MobilityDB/meos/src/point/pgis_types.c: In function ‘geom_in’:
/home/maxime/Documents/phd/code/MobilityDB/meos/postgres/postgres.h:75:15: warning: ‘free’ called on pointer ‘tmp’ with nonzero offset 5 [-Wfree-nonheap-object]
75 | #define pfree free
/home/maxime/Documents/phd/code/MobilityDB/meos/src/point/pgis_types.c:1757:7: note: in expansion of macro ‘pfree’
1757 | pfree(tmp);
| ^~~~~
/home/maxime/Documents/phd/code/MobilityDB/meos/postgres/postgres.h:73:16: note: returned from ‘malloc’
73 | #define palloc malloc
/home/maxime/Documents/phd/code/MobilityDB/meos/src/point/pgis_types.c:1747:19: note: in expansion of macro ‘palloc’
1747 | char *tmp = palloc(sizeof(char) * (delim + 1));
Not sure what the actual behaviour is, but this should probably be fixed in a future PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.