kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=b45ea50c4b407abba616ba35ab9cbeb76ea7d9b1
commit b45ea50c4b407abba616ba35ab9cbeb76ea7d9b1 Author: Kim Woelders <[email protected]> Date: Thu Oct 28 16:16:54 2021 +0200 Loader loading: Move to __imlib_FindBestLoaderForFormat() --- src/lib/image.c | 4 ---- src/lib/image.h | 1 - src/lib/loaders.c | 8 ++++---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/lib/image.c b/src/lib/image.c index 6617e15..6164cf0 100644 --- a/src/lib/image.c +++ b/src/lib/image.c @@ -736,8 +736,6 @@ __imlib_LoadImage(const char *file, FILE * fp, ImlibProgressFunction progress, immediate_load = 1; } - __imlib_LoadAllLoaders(); - loader_ret = LOAD_FAIL; /* take a guess by extension on the best loader to use */ @@ -1005,8 +1003,6 @@ __imlib_SaveImage(ImlibImage * im, const char *file, return; } - __imlib_LoadAllLoaders(); - /* find the laoder for the format - if its null use the extension */ l = __imlib_FindBestLoaderForFileFormat(file, im->format, 1); /* no loader - abort */ diff --git a/src/lib/image.h b/src/lib/image.h index c473365..c686dd6 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -90,7 +90,6 @@ struct _imlibimagepixmap { }; #endif -void __imlib_LoadAllLoaders(void); void __imlib_RemoveAllLoaders(void); ImlibLoader **__imlib_GetLoaderList(void); ImlibLoader *__imlib_FindBestLoaderForFile(const char *file, diff --git a/src/lib/loaders.c b/src/lib/loaders.c index aeb2895..914b818 100644 --- a/src/lib/loaders.c +++ b/src/lib/loaders.c @@ -97,7 +97,7 @@ __imlib_RemoveAllLoaders(void) /* find all the loaders we can find and load them up to see what they can */ /* load / save */ -void +static void __imlib_LoadAllLoaders(void) { int i, num; @@ -105,9 +105,6 @@ __imlib_LoadAllLoaders(void) DP("%s\n", __func__); - if (loaders) - return; - /* list all the loaders imlib can find */ list = __imlib_ListModules(__imlib_PathToLoaders(), &num); /* no loaders? well don't load anything */ @@ -134,6 +131,9 @@ __imlib_FindBestLoaderForFormat(const char *format, int for_save) 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 */ --
