This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 875faa3fdc348ff6f403adff418ecddca4c92894
Author: Kim Woelders <[email protected]>
AuthorDate: Sat Apr 29 21:48:09 2023 +0200

    loading: Enable calling function on loader load/unload
---
 src/lib/Imlib2_Loader.h | 13 +++++++++----
 src/lib/loaders.c       |  6 ++++++
 src/lib/loaders.h       |  3 ++-
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/lib/Imlib2_Loader.h b/src/lib/Imlib2_Loader.h
index e8d45bb..5c55433 100644
--- a/src/lib/Imlib2_Loader.h
+++ b/src/lib/Imlib2_Loader.h
@@ -210,7 +210,7 @@ int                 __imlib_LoadProgressRows(ImlibImage * im,
 
 /* loader.h */
 
-#define IMLIB2_LOADER_VERSION 2
+#define IMLIB2_LOADER_VERSION 3
 
 #define LDR_FLAG_KEEP   0x01    /* Don't unload loader */
 
@@ -219,25 +219,30 @@ typedef struct {
    unsigned char       ldr_flags;       /* LDR_FLAG_... */
    unsigned short      num_formats;     /* Length og known extension list */
    const char         *const *formats;  /* Known extension list */
+   void                (*inex)(int init);       /* Module init/exit */
    int                 (*load)(ImlibImage * im, int load_data);
    int                 (*save)(ImlibImage * im);
 } ImlibLoaderModule;
 
-#define IMLIB_LOADER_(_fmts, _ldr, _svr, _flags) \
+#define IMLIB_LOADER_(_fmts, _ldr, _svr, _inex, _flags) \
     __EXPORT__ ImlibLoaderModule loader = { \
         .ldr_version = IMLIB2_LOADER_VERSION, \
         .ldr_flags = _flags, \
         .num_formats = ARRAY_SIZE(_fmts), \
         .formats = _fmts, \
+        .inex = _inex, \
         .load = _ldr, \
         .save = _svr, \
     }
 
 #define IMLIB_LOADER(_fmts, _ldr, _svr) \
-    IMLIB_LOADER_(_fmts, _ldr, _svr, 0)
+    IMLIB_LOADER_(_fmts, _ldr, _svr, NULL, 0)
 
 #define IMLIB_LOADER_KEEP(_fmts, _ldr, _svr) \
-    IMLIB_LOADER_(_fmts, _ldr, _svr, LDR_FLAG_KEEP)
+    IMLIB_LOADER_(_fmts, _ldr, _svr, NULL, LDR_FLAG_KEEP)
+
+#define IMLIB_LOADER_INEX(_fmts, _ldr, _svr, _inex) \
+    IMLIB_LOADER_(_fmts, _ldr, _svr, _inex, 0)
 
 #define QUIT_WITH_RC(_err) { rc = _err; goto quit; }
 
diff --git a/src/lib/loaders.c b/src/lib/loaders.c
index 6995cdf..a3af200 100644
--- a/src/lib/loaders.c
+++ b/src/lib/loaders.c
@@ -205,6 +205,9 @@ __imlib_ProduceLoader(const char *file)
    l->next = loaders;
    loaders = l;
 
+   if (l->module->inex)
+      l->module->inex(1);
+
    return l;
 
  bail:
@@ -224,6 +227,9 @@ __imlib_ConsumeLoader(ImlibLoader * l)
         return;
      }
 
+   if (l->module->inex)
+      l->module->inex(0);
+
    if (l->handle)
       dlclose(l->handle);
 
diff --git a/src/lib/loaders.h b/src/lib/loaders.h
index 8975172..0786a7b 100644
--- a/src/lib/loaders.h
+++ b/src/lib/loaders.h
@@ -3,7 +3,7 @@
 
 #include "types.h"
 
-#define IMLIB2_LOADER_VERSION 2
+#define IMLIB2_LOADER_VERSION 3
 
 #define LDR_FLAG_KEEP   0x01    /* Don't unload loader */
 
@@ -12,6 +12,7 @@ typedef struct {
    unsigned char       ldr_flags;       /* LDR_FLAG_... */
    unsigned short      num_formats;     /* Length og known extension list */
    const char         *const *formats;  /* Known extension list */
+   void                (*inex)(int init);       /* Module init/exit */
    int                 (*load)(ImlibImage * im, int load_data);
    int                 (*save)(ImlibImage * im);
 } ImlibLoaderModule;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to