Skip to content

Conversation

@kalmard0
Copy link
Contributor

This is a C++20 feature. This change is required to support C++17, at
least on non-msvc compilers.

The functionality is replaced with an ink-internal alternative.

@kalmard0
Copy link
Contributor Author

Note: I'm not sure how to test this properly. Unit tests are passing.

@kalmard0 kalmard0 marked this pull request as ready for review April 23, 2025 07:27
This is a C++20 feature. This change is required to support C++17, at
least on non-msvc compilers.

The functionality is replaced with an ink-internal alternative.
@JBenda
Copy link
Owner

JBenda commented Apr 24, 2025

An oversight, thanks for spotting, I would add the following patch to avoid errors if the prefix is longer than the string.
git am 0001-Hardend-starts_with.patch
0001-Hardend-starts_with.patch

@kalmard0
Copy link
Contributor Author

If the prefix is longer than the string, *string will eventually be 0 (null-terminated C-style string), so the following branch will trigger:

	if (*string != *prefix) {
		return false;
	}

Of course I'm happy to apply your patch if you prefer.

@JBenda
Copy link
Owner

JBenda commented Apr 24, 2025

Yea, you are right. Thanks for the clarification.

@JBenda JBenda merged commit 1dd0fa9 into JBenda:master Apr 24, 2025
8 of 9 checks passed
@kalmard0 kalmard0 deleted the startswith branch April 24, 2025 10:44
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