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

lib/gis: match prototype with declaration for G_strlcat and G_strlcpy #4332

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

nilason
Copy link
Contributor

@nilason nilason commented Sep 17, 2024

Make local implementations of strlcpy() and strlcat() optimizable by using restrict type qualifier, while keeping public API for G_strlcat and G_strlcpy available to C++ code and having identical prototype and declaration.

Currently the prototypes look like:

size_t G_strlcat(char *, const char *, size_t);

but declared as:

size_t G_strlcat(char *restrict dst, const char *restrict src, size_t dsize) { ...}

which the compilers seem to accept, but was probably not the best choice.

Make local implementations of strlcpy() and strlcat() optimizable by
using restrict type qualifier, while keeping public API for G_strlcat
and G_strlcpy available to C++ code and having identical prototype and
declaration.
@nilason nilason added this to the 8.5.0 milestone Sep 17, 2024
@nilason nilason self-assigned this Sep 17, 2024
@github-actions github-actions bot added C Related code is in C libraries labels Sep 17, 2024
Copy link
Member

@wenzeslaus wenzeslaus left a comment

Choose a reason for hiding this comment

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

That makes sense and even somewhat looks like the other wrappers we have elsewhere!

@nilason nilason merged commit da15442 into OSGeo:main Sep 18, 2024
27 checks passed
@nilason nilason deleted the libgis_hide_restrict branch September 18, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants