The following commit has been merged in the master branch:
commit 8ff7219457b3c6e75006d18d4d1d39e2aa62205b
Author: Guillem Jover <[email protected]>
Date:   Sat Feb 27 23:13:45 2010 +0100

    libdpkg: Add new trig_override_hooks to avoid exposing trigh
    
    Make trigh static and create an overrider function for it.

diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index 5888048..8c1b7c7 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -276,14 +276,14 @@ struct trig_hooks {
   const char *(*namenode_name)(struct filenamenode *fnn);
 };
 
-extern struct trig_hooks trigh;
-
 #define TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS                             \
   static struct trigfileint **th_nn_interested(struct filenamenode *fnn) \
     { return &fnn->trig_interested; }                                   \
   static const char *th_nn_name(struct filenamenode *fnn)               \
     { return fnn->name; }
 
+void trig_override_hooks(const struct trig_hooks *hooks);
+
 /*** from triglib.c ***/
 
 void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index bbabd30..118994b 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -53,6 +53,8 @@ illegal_triggername(const char *p)
 
 /*========== recording triggers ==========*/
 
+static struct trig_hooks trigh;
+
 /*---------- noting trigger activation in memory ----------*/
 
 /* Called via trig_*activate* et al from:
@@ -799,7 +801,7 @@ th_simple_nn_find(const char *name, int nonew)
 
 TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS
 
-struct trig_hooks trigh = {
+static struct trig_hooks trigh = {
        .enqueue_deferred = NULL,
        .transitional_activate = NULL,
        .namenode_find = th_simple_nn_find,
@@ -807,3 +809,8 @@ struct trig_hooks trigh = {
        .namenode_name = th_nn_name,
 };
 
+void
+trig_override_hooks(const struct trig_hooks *hooks)
+{
+       trigh = *hooks;
+}
diff --git a/src/trigproc.c b/src/trigproc.c
index 155f464..972fc9c 100644
--- a/src/trigproc.c
+++ b/src/trigproc.c
@@ -397,6 +397,6 @@ static const struct trig_hooks trig_our_hooks = {
 void
 trigproc_install_hooks(void)
 {
-       trigh = trig_our_hooks;
+       trig_override_hooks(&trig_our_hooks);
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to