Skip to content

Add const qualifier for string parameters#626

Merged
mschoema merged 1 commit intoMobilityDB:masterfrom
estebanzimanyi:const
Oct 9, 2024
Merged

Add const qualifier for string parameters#626
mschoema merged 1 commit intoMobilityDB:masterfrom
estebanzimanyi:const

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

No description provided.

@mschoema mschoema merged commit 9c0af7b into MobilityDB:master Oct 9, 2024
@mschoema mschoema deleted the const branch October 9, 2024 16:33
tmp += 5;
/* Parse out the SRID number */
srid = atoi(tmp);
pfree(tmp);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

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