From 92c12d1a8ef11106df69b07ca357c560e07e9efd Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 13 Sep 2010 13:08:33 +0300 Subject: [PATCH] Eliminate all fooUnlink() functions out of the API - These are internal helpers only, all refcount users need to use fooFree() or similar for correct operation. Add fwd declarations where necessary to avoid moving code around unnecessarily. - We could add these back later as aliases to fooFree() but for now, just get them out of the way. --- lib/header.c | 2 +- lib/header.h | 7 ------- lib/rpmdb.c | 3 ++- lib/rpmdb.h | 7 ------- lib/rpmds.c | 2 +- lib/rpmds.h | 7 ------- lib/rpmfi.c | 2 +- lib/rpmfi.h | 7 ------- lib/rpmprob.c | 4 +++- lib/rpmprob.h | 7 ------- lib/rpmps.c | 2 +- lib/rpmps.h | 7 ------- lib/rpmts.c | 2 +- lib/rpmts.h | 7 ------- rpmio/rpmkeyring.c | 7 +++++-- rpmio/rpmkeyring.h | 14 -------------- 16 files changed, 15 insertions(+), 72 deletions(-) diff --git a/lib/header.c b/lib/header.c index d0983c1..aaa2a98 100644 --- a/lib/header.c +++ b/lib/header.c @@ -126,7 +126,7 @@ Header headerLink(Header h) return h; } -Header headerUnlink(Header h) +static Header headerUnlink(Header h) { if (h != NULL) h->nrefs--; diff --git a/lib/header.h b/lib/header.h index c362555..e038184 100644 --- a/lib/header.h +++ b/lib/header.h @@ -55,13 +55,6 @@ Header headerFree( Header h); Header headerLink(Header h); /** \ingroup header - * Dereference a header instance. - * @param h header - * @return new header reference - */ -Header headerUnlink(Header h); - -/** \ingroup header * Sort tags in header. * @param h header */ diff --git a/lib/rpmdb.c b/lib/rpmdb.c index e7d7f4d..41ee92c 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -75,6 +75,7 @@ typedef struct _dbiIndexSet { } * dbiIndexSet; static unsigned int pkgInstance(dbiIndex dbi, int new); +static rpmdb rpmdbUnlink(rpmdb db); /* Bit mask macros. */ typedef unsigned int __pbm_bits; @@ -732,7 +733,7 @@ static int openDatabase(const char * prefix, return rc; } -rpmdb rpmdbUnlink(rpmdb db) +static rpmdb rpmdbUnlink(rpmdb db) { if (db) db->nrefs--; diff --git a/lib/rpmdb.h b/lib/rpmdb.h index 8a5f131..c130a42 100644 --- a/lib/rpmdb.h +++ b/lib/rpmdb.h @@ -39,13 +39,6 @@ typedef enum rpmdbOpX_e { rpmop rpmdbOp(rpmdb db, rpmdbOpX opx); /** \ingroup rpmdb - * Unreference a database instance. - * @param db rpm database - * @return NULL always - */ -rpmdb rpmdbUnlink(rpmdb db); - -/** \ingroup rpmdb * Reference a database instance. * @param db rpm database * @return new rpm database reference diff --git a/lib/rpmds.c b/lib/rpmds.c index d183038..c355300 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -74,7 +74,7 @@ static int dsType(rpmTag tag, return rc; } -rpmds rpmdsUnlink(rpmds ds) +static rpmds rpmdsUnlink(rpmds ds) { if (ds) ds->nrefs--; diff --git a/lib/rpmds.h b/lib/rpmds.h index 7525020..b093224 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -81,13 +81,6 @@ typedef enum rpmsenseFlags_e { #define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK) /** \ingroup rpmds - * Unreference a dependency set instance. - * @param ds dependency set - * @return NULL always - */ -rpmds rpmdsUnlink(rpmds ds); - -/** \ingroup rpmds * Reference a dependency set instance. * @param ds dependency set * @return new dependency set reference diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 6ffcafb..d1c69c5 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -86,7 +86,7 @@ static strcache strcacheFree(strcache cache) return NULL; } -rpmfi rpmfiUnlink(rpmfi fi) +static rpmfi rpmfiUnlink(rpmfi fi) { if (fi) fi->nrefs--; diff --git a/lib/rpmfi.h b/lib/rpmfi.h index d4123d0..84f6da8 100644 --- a/lib/rpmfi.h +++ b/lib/rpmfi.h @@ -94,13 +94,6 @@ struct rpmRelocation_s { }; /** \ingroup rpmfi - * Unreference a file info set instance. - * @param fi file info set - * @return NULL always - */ -rpmfi rpmfiUnlink (rpmfi fi); - -/** \ingroup rpmfi * Reference a file info set instance. * @param fi file info set * @return new file info set reference diff --git a/lib/rpmprob.c b/lib/rpmprob.c index b22ecb3..df9c578 100644 --- a/lib/rpmprob.c +++ b/lib/rpmprob.c @@ -22,6 +22,8 @@ struct rpmProblem_s { int nrefs; }; +static rpmProblem rpmProblemUnlink(rpmProblem prob); + rpmProblem rpmProblemCreate(rpmProblemType type, const char * pkgNEVR, fnpyKey key, const char * altNEVR, @@ -62,7 +64,7 @@ rpmProblem rpmProblemLink(rpmProblem prob) return prob; } -rpmProblem rpmProblemUnlink(rpmProblem prob) +static rpmProblem rpmProblemUnlink(rpmProblem prob) { if (prob) { prob->nrefs--; diff --git a/lib/rpmprob.h b/lib/rpmprob.h index 296877e..5ca5d11 100644 --- a/lib/rpmprob.h +++ b/lib/rpmprob.h @@ -79,13 +79,6 @@ rpmProblem rpmProblemFree(rpmProblem prob); rpmProblem rpmProblemLink(rpmProblem prob); /** \ingroup rpmprob - * Unreference an rpmProblem instance - * @param prob rpm problem - * @return rpm problem - */ -rpmProblem rpmProblemUnlink(rpmProblem prob); - -/** \ingroup rpmprob * Compare two problems for equality. * @param ap 1st problem * @param bp 2nd problem diff --git a/lib/rpmps.c b/lib/rpmps.c index e7a0bf0..6e1ab18 100644 --- a/lib/rpmps.c +++ b/lib/rpmps.c @@ -25,7 +25,7 @@ struct rpmpsi_s { }; -rpmps rpmpsUnlink(rpmps ps) +static rpmps rpmpsUnlink(rpmps ps) { if (ps) { ps->nrefs--; diff --git a/lib/rpmps.h b/lib/rpmps.h index 4b1050b..1b1142b 100644 --- a/lib/rpmps.h +++ b/lib/rpmps.h @@ -20,13 +20,6 @@ extern "C" { typedef struct rpmpsi_s * rpmpsi; /** \ingroup rpmps - * Unreference a problem set instance. - * @param ps problem set - * @return problem set - */ -rpmps rpmpsUnlink (rpmps ps); - -/** \ingroup rpmps * Reference a problem set instance. * @param ps transaction set * @return new transaction set reference diff --git a/lib/rpmts.c b/lib/rpmts.c index 855e376..1bf58e9 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -42,7 +42,7 @@ static void loadKeyring(rpmts ts); int _rpmts_stats = 0; -rpmts rpmtsUnlink(rpmts ts) +static rpmts rpmtsUnlink(rpmts ts) { if (ts) ts->nrefs--; diff --git a/lib/rpmts.h b/lib/rpmts.h index 04fc9d1..e03a704 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -196,13 +196,6 @@ int rpmtsOrder(rpmts ts); int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet); /** \ingroup rpmts - * Unreference a transaction instance. - * @param ts transaction set - * @return NULL always - */ -rpmts rpmtsUnlink (rpmts ts); - -/** \ingroup rpmts * Reference a transaction set instance. * @param ts transaction set * @return new transaction set reference diff --git a/rpmio/rpmkeyring.c b/rpmio/rpmkeyring.c index 0ffbe1e..2453289 100644 --- a/rpmio/rpmkeyring.c +++ b/rpmio/rpmkeyring.c @@ -24,6 +24,9 @@ struct rpmKeyring_s { int nrefs; }; +static rpmPubkey rpmPubkeyUnlink(rpmPubkey key); +static rpmKeyring rpmKeyringUnlink(rpmKeyring keyring); + static int keyidcmp(const void *k1, const void *k2) { const struct rpmPubkey_s *key1 = *(const struct rpmPubkey_s **) k1; @@ -94,7 +97,7 @@ rpmKeyring rpmKeyringLink(rpmKeyring keyring) return keyring; } -rpmKeyring rpmKeyringUnlink(rpmKeyring keyring) +static rpmKeyring rpmKeyringUnlink(rpmKeyring keyring) { if (keyring) { keyring->nrefs--; @@ -157,7 +160,7 @@ rpmPubkey rpmPubkeyLink(rpmPubkey key) return key; } -rpmPubkey rpmPubkeyUnlink(rpmPubkey key) +static rpmPubkey rpmPubkeyUnlink(rpmPubkey key) { if (key) { key->nrefs--; diff --git a/rpmio/rpmkeyring.h b/rpmio/rpmkeyring.h index 8b7c534..8b4378b 100644 --- a/rpmio/rpmkeyring.h +++ b/rpmio/rpmkeyring.h @@ -48,13 +48,6 @@ rpmRC rpmKeyringLookup(rpmKeyring keyring, pgpDig sig); rpmKeyring rpmKeyringLink(rpmKeyring keyring); /** \ingroup rpmkeyring - * Unreference a keyring. - * @param keyring keyring handle - * @return NULL always - */ -rpmKeyring rpmKeyringUnlink(rpmKeyring keyring); - -/** \ingroup rpmkeyring * Create a new rpmPubkey from OpenPGP packet * @param pkt OpenPGP packet data * @param pktlen Data length @@ -84,13 +77,6 @@ rpmPubkey rpmPubkeyFree(rpmPubkey key); rpmPubkey rpmPubkeyLink(rpmPubkey key); /** \ingroup rpmkeyring - * Unreference a pubkey. - * @param key Pubkey - * @return NULL always - */ -rpmPubkey rpmPubkeyUnlink(rpmPubkey key); - -/** \ingroup rpmkeyring * Parse OpenPGP pubkey parameters. * @param key Pubkey * @return parsed output of pubkey packet parameters -- 2.7.4