diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-11-18 18:21:17 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-11-18 18:21:17 +0300 |
commit | beb9e332caac7052db20584e61bd832df1efb680 (patch) | |
tree | 900c6d32b59e55dfc28703b3979fd2209590875c /source/blender/editors/space_file/filelist.c | |
parent | d1f944c18634f215c3da0484ac3b80e994118680 (diff) | |
parent | 31afa1bb9abf6adcfcb0efc0e227076fa47d92ba (diff) |
Merge remote-tracking branch 'origin/blender-v3.0-release'
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index d32e947d688..1fb8132852a 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -922,19 +922,6 @@ static void prepare_filter_asset_library(const FileList *filelist, FileListFilte } /** - * Copy a string from source to `dest`, but prefix and suffix it with a single space. - * Assumes `dest` has at least space enough for the two spaces. - */ -static void tag_copy_with_spaces(char *dest, const char *source, const size_t dest_size) -{ - BLI_assert(dest_size > 2); - const size_t source_length = BLI_strncpy_rlen(dest + 1, source, dest_size - 2); - dest[0] = ' '; - dest[source_length + 1] = ' '; - dest[source_length + 2] = '\0'; -} - -/** * Return whether at least one tag matches the search filter. * Tags are searched as "entire words", so instead of searching for "tag" in the * filter string, this function searches for " tag ". Assumes the search filter @@ -949,9 +936,7 @@ static void tag_copy_with_spaces(char *dest, const char *source, const size_t de static bool asset_tag_matches_filter(const char *filter_search, const AssetMetaData *asset_data) { LISTBASE_FOREACH (const AssetTag *, asset_tag, &asset_data->tags) { - char tag_name[MAX_NAME + 2]; /* sizeof(AssetTag::name) + 2 */ - tag_copy_with_spaces(tag_name, asset_tag->name, sizeof(tag_name)); - if (BLI_strcasestr(filter_search, tag_name) != NULL) { + if (BLI_strcasestr(asset_tag->name, filter_search) != NULL) { return true; } } @@ -982,13 +967,7 @@ static bool is_filtered_asset(FileListInternEntry *file, FileListFilter *filter) if (BLI_strcasestr(file->name, filter_search + 1) != NULL) { return true; } - - /* Replace the asterisks with spaces, so that we can do matching on " sometag "; that way - * an artist searching for "redder" doesn't result in a match for the tag "red". */ - filter_search[string_length - 1] = ' '; - filter_search[0] = ' '; - - return asset_tag_matches_filter(filter_search, asset_data); + return asset_tag_matches_filter(filter_search + 1, asset_data); } static bool is_filtered_lib_type(FileListInternEntry *file, |