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/filterx: add startswith / endswith / includes functions #297

Merged
merged 6 commits into from
Oct 2, 2024

Conversation

OverOrion
Copy link
Contributor

@OverOrion OverOrion commented Sep 19, 2024

Init time optimized version of #277.
I opted for closing that because the changes are really different.

@OverOrion OverOrion force-pushed the filterx-startswith-cached branch 9 times, most recently from 899e102 to 6319d72 Compare September 20, 2024 14:21
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
@OverOrion OverOrion force-pushed the filterx-startswith-cached branch 4 times, most recently from bcf682b to 3da97bf Compare September 23, 2024 15:03
@OverOrion OverOrion marked this pull request as draft September 24, 2024 08:22
@OverOrion OverOrion changed the title lib/filterx: add startswith / endswith / find_substring functions lib/filterx: add startswith / endswith / includes functions Sep 24, 2024
@OverOrion OverOrion force-pushed the filterx-startswith-cached branch 2 times, most recently from 388c6ca to c6165b5 Compare September 24, 2024 15:31
@OverOrion OverOrion marked this pull request as ready for review September 24, 2024 16:02
@OverOrion OverOrion marked this pull request as draft September 24, 2024 16:03
@OverOrion OverOrion marked this pull request as ready for review September 25, 2024 08:55
@OverOrion OverOrion self-assigned this Sep 25, 2024
if(self->str_len > G_MAXSSIZE)
return FALSE;

self->owned_str_value = g_utf8_casefold(self->borrowed_str_value, (gssize) self->str_len);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The string comparisons might need g_utf8_normalize() as well besides case insensitive form.
I did not use it yet as I wanted a confirmation about the UTF8-ness of strings in this context.
@bazsi @alltilla What do you think? 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The official docs say for the deprecated strncasecmp:

[...] There are therefore two replacement techniques:
g_ascii_strncasecmp(), which only works on ASCII and is not locale-sensitive,

and g_utf8_casefold() followed by strcmp() on the resulting strings, which is good for case-insensitive sorting of UTF-8.

@OverOrion OverOrion force-pushed the filterx-startswith-cached branch 2 times, most recently from 112b464 to 2b30d3b Compare September 29, 2024 16:10
Copy link
Member

@alltilla alltilla left a comment

Choose a reason for hiding this comment

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

Looks good!

There are a couple of things to resolve, then after another review round it will be probably merge ready :)

lib/filterx/func-str.c Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
@alltilla
Copy link
Member

Sorry, there were some review comments stuck in from a previous session. Resolved everything that is already fixed.

@OverOrion OverOrion force-pushed the filterx-startswith-cached branch 3 times, most recently from 90c83b6 to 087a1ee Compare October 1, 2024 12:02
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
lib/filterx/func-str.c Outdated Show resolved Hide resolved
This will be used for startswith/endswith/includes functions

Signed-off-by: Szilard Parrag <[email protected]>
@alltilla alltilla merged commit ba344fa into axoflow:main Oct 2, 2024
22 checks passed
fekete-robert pushed a commit to axoflow/axosyslog-core-docs that referenced this pull request Nov 10, 2024
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.

3 participants