kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=1cf913701cd32ac4bc5e90332c0ecc0aab7568f5
commit 1cf913701cd32ac4bc5e90332c0ecc0aab7568f5 Author: Kim Woelders <[email protected]> Date: Thu Oct 28 16:16:38 2021 +0200 Loader loading: Minor loader lookup refactoring Split off __imlib_LookupLoadedLoader() which just does lookup in loaded loader list. --- src/lib/loaders.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/lib/loaders.c b/src/lib/loaders.c index 2371c4c..d3f2b8b 100644 --- a/src/lib/loaders.c +++ b/src/lib/loaders.c @@ -121,19 +121,13 @@ __imlib_GetLoaderList(void) return &loaders; } -__EXPORT__ ImlibLoader * -__imlib_FindBestLoaderForFormat(const char *format, int for_save) +static ImlibLoader * +__imlib_LookupLoadedLoader(const char *format, int for_save) { ImlibLoader *l; DP("%s: fmt='%s'\n", __func__, format); - if (!format || format[0] == '\0') - return NULL; - - if (!loaders) - __imlib_LoadAllLoaders(); - /* go through the loaders - first loader that claims to handle that */ /* image type (extension wise) wins as a first guess to use - NOTE */ /* this is an OPTIMISATION - it is possible the file has no extension */ @@ -169,6 +163,25 @@ __imlib_FindBestLoaderForFormat(const char *format, int for_save) return l; } +__EXPORT__ ImlibLoader * +__imlib_FindBestLoaderForFormat(const char *format, int for_save) +{ + ImlibLoader *l; + + DP("%s: fmt='%s'\n", __func__, format); + + if (!format || format[0] == '\0') + return NULL; + + if (!loaders) + __imlib_LoadAllLoaders(); + + l = __imlib_LookupLoadedLoader(format, for_save); + + DP("%s: fmt='%s': %s\n", __func__, format, l ? l->file : "-"); + return l; +} + __EXPORT__ ImlibLoader * __imlib_FindBestLoaderForFile(const char *file, int for_save) { --
