-
Notifications
You must be signed in to change notification settings - Fork 17
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
filterx: rework of unset_empties #275
Conversation
lib/filterx/func-unset-empties.c
Outdated
gsize str_len; | ||
const gchar *str; | ||
if (filterx_object_extract_string(obj, &str, &str_len) && str_len == 0) | ||
return TRUE; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this above the dict and list handling part, but the processing of it is below that?
lib/filterx/func-unset-empties.c
Outdated
const gchar *str; | ||
if (filterx_object_extract_string(obj, &str, &str_len) && str_len == 0) | ||
return TRUE; | ||
|
||
if (filterx_object_is_type(obj, &FILTERX_TYPE_NAME(dict)) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit strange for me that the user cannot change the behavior of handling list
s, dict
s and null
s.
I don't know if they want to do it, but this seems asymmetric. If as a user I were to set the target strings, and null
s and empty dict
s were getting removed, I would be surprised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would be the proper way to handle that case?
8b47daa
to
ece5629
Compare
9d7ebfa
to
6942182
Compare
6942182
to
a5683a9
Compare
…ardize function flag handling Signed-off-by: shifter <shifter@axoflow.com>
Signed-off-by: shifter <shifter@axoflow.com>
- filterx_expr_is_literal_generator function added - proper inner_dict_generator handling in filterx_expr_is_literal_dict_generator - proper inner_list_generator handling in filterx_expr_is_literal_list_generator Signed-off-by: shifter <shifter@axoflow.com>
- Default empty set: "", null, [], {}. - Optional named arguments: - recursive: Enables recursive processing of nested dictionaries. - ignorecase: Enables case-insensitive matching. - replacement: Specifies a filterxobject to replace target elements instead of removing them. - targets: A list of elements to identify for removal or replacement, clearing the default empty set. - UTF-8 support. - ignorecase and recursive args are defaults to TRUE This change removes elements from the given dictionary or list that match the empty set. If the recursive argument is provided, the function will process nested dictionaries as well. The replacement argument allows replacing target elements with a specified object, and the targets argument customizes which elements are removed or replaced, overriding the default empty set. Signed-off-by: shifter <shifter@axoflow.com>
Signed-off-by: shifter <shifter@axoflow.com>
Signed-off-by: shifter <shifter@axoflow.com>
a5683a9
to
2f53c8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool feature :)
- Optional named arguments:
- UTF-8 support.
- ignorecase and recursive args are defaults to TRUE
example: