style string can contain any kind of white spaces and it will be fine
For example
"font=sans font_size=30 color=red "
Is the same as
"font=sans\tfont_size=30\n color=red "
style string can contain any kind of white spaces and it will be fine
For example
"font=sans font_size=30 color=red "
Is the same as
"font=sans\tfont_size=30\n color=red "
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
It seems that this patch has no reviewers specified. If you are unsure who can review your patch, please check this wiki page and see if anyone can be added: https://phab.enlightenment.org/w/maintainers_reviewers/
src/lib/evas/canvas/evas_object_textblock.c | ||
---|---|---|
3310 | I hate that this list of whitespace chars is duplicated from the "ifs" in line 1333. |
src/lib/evas/canvas/evas_object_textblock.c | ||
---|---|---|
3310 | This method can not call _is_char_white, because that method does not return white space characters |
I think you misunderstood a bit what @segfaultxavi is pointing out. There should not be the "same" list of characters twice. It would be way better from a quality POV that both functions either use the same list of characters that are considered a whitespace, or simply iterate over the str and call _is_char_white on every character in the string. So we deduplicate this. And only have a single point of "we consider this whitespace".
src/lib/evas/canvas/evas_object_textblock.c | ||
---|---|---|
1329 | Now that you've decided to use an array, isn't this method functionally equivalent to strchr? |
src/lib/evas/canvas/evas_object_textblock.c | ||
---|---|---|
1329 |
Of course, it is not !!
No difference |
Nice! The patch is getting smaller and smaller.
Now, regarding, _strchr_whitespace, it is still unclear to me why do you need such a complex method. Could something like this work?
// Returns first occurrence of whitespace character or NULL static char* _strchr_whitespace(const char* str) { while (*str && !isspace(*str)) str++; if (*str) return str; return NULL; }
src/lib/evas/canvas/evas_object_textblock.c | ||
---|---|---|
3292 | This code will not return NULL if a whitespace is not found, it will return a pointer to the \0 at the end of the string. |
src/lib/evas/canvas/evas_object_textblock.c | ||
---|---|---|
3292 | I am not aging well!!! |
Good!
I have no more complains :)
Builds, passes tests, and the initial issue from T8532 is fixed.