[Pkg-wmaker-commits] [wmbiff] 34/38: switch the new header cache to use reference counting (better, but possibly buggy) instead of locking (dumb, and certainly buggy)
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:03:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_16
in repository wmbiff.
commit e5089013831ecf96eb063815c4462dcac87dde14
Author: bluehal <bluehal>
Date: Thu Jul 3 11:10:32 2003 +0000
switch the new header cache to use reference counting (better, but possibly buggy) instead of locking (dumb, and certainly buggy)
---
wmbiff/Imap4Client.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/wmbiff/Imap4Client.c b/wmbiff/Imap4Client.c
index b5667f4..0c62df4 100644
--- a/wmbiff/Imap4Client.c
+++ b/wmbiff/Imap4Client.c
@@ -354,16 +354,9 @@ void imap_cacheHeaders( /*@notnull@ */ Pop3 pc)
}
if (pc->headerCache != NULL) {
- /* make sure the current copy is "unlocked" */
- if (pc->headerCache->in_use == 1) {
- return;
- }
- /* free the old one */
- for (h = pc->headerCache; h != NULL;) {
- struct msglst *n = h->next;
- free(h);
- h = n;
- }
+ /* decrement the reference count, and free our version */
+ imap_releaseHeaders(pc, pc->headerCache);
+ pc->headerCache = NULL;
}
IMAP_DM(pc, DEBUG_INFO, "working headers\n");
@@ -443,7 +436,16 @@ void imap_releaseHeaders(Pop3 pc
{
assert(h != NULL);
/* allow the list to be released next time around */
- h->in_use = 0;
+ if (h->in_use <= 0) {
+ /* free the old one */
+ while (h != NULL) {
+ struct msglst *n = h->next;
+ free(h);
+ h = n;
+ }
+ } else {
+ h->in_use--;
+ }
}
/* parse the config line to setup the Pop3 structure */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list