RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 25-Mar-2009 21:11:21 Branch: rpm-5_1 Handle: 2009032520112001 Modified files: (Branch: rpm-5_1) rpm CHANGES rpm/rpmio rpmzlog.c rpmzlog.h Log: - zlog: use struct rpmioItem_s use/pool container. Summary: Revision Changes Path 1.2288.2.244+1 -0 rpm/CHANGES 2.4.2.4 +19 -14 rpm/rpmio/rpmzlog.c 2.3.2.4 +9 -8 rpm/rpmio/rpmzlog.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2288.2.243 -r1.2288.2.244 CHANGES --- rpm/CHANGES 25 Mar 2009 19:56:56 -0000 1.2288.2.243 +++ rpm/CHANGES 25 Mar 2009 20:11:20 -0000 1.2288.2.244 @@ -1,4 +1,5 @@ 5.1.7 -> 5.1.8: + - jbj: zlog: use struct rpmioItem_s use/pool container. - jbj: poptIO: add --htdebug. - jbj: yarn: convert rpmfc to usage mutex with refcounts. - jbj: yarn: convert hashTable to usage mutex with refcounts. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmzlog.c ============================================================================ $ cvs diff -u -r2.4.2.3 -r2.4.2.4 rpmzlog.c --- rpm/rpmio/rpmzlog.c 16 Mar 2009 17:27:23 -0000 2.4.2.3 +++ rpm/rpmio/rpmzlog.c 25 Mar 2009 20:11:21 -0000 2.4.2.4 @@ -46,6 +46,7 @@ #include "debug.h" +/*...@unchecked@*/ static int _rpmzlog_debug = 0; /*...@access rpmzMsg @*/ @@ -62,11 +63,11 @@ if (zlog == NULL) return NULL; - yarnPossess(zlog->use); - nrefs = yarnPeekLock(zlog->use); + yarnPossess(zlog->_item.use); + nrefs = yarnPeekLock(zlog->_item.use); if (_rpmzlog_debug) fprintf(stderr, " ++ zlog %p[%ld]\n", zlog, nrefs+1); - yarnTwist(zlog->use, BY, 1); + yarnTwist(zlog->_item.use, BY, 1); return zlog; } @@ -74,16 +75,20 @@ { rpmzLog zlog = xcalloc(1, sizeof(*zlog)); - zlog->use = yarnNewLock(0); + zlog->_item.use = yarnNewLock(0); zlog->msg_head = NULL; zlog->msg_tail = &zlog->msg_head; /* starting time for log entries */ +/*...@-assignexpose@*/ if (tv != NULL) zlog->start = *tv; /* structure assignment */ else (void) gettimeofday(&zlog->start, NULL); +/*...@=assignexpose@*/ +/*...@-nullret@*/ return rpmzLogLink(zlog); +/*...@=nullret@*/ } void rpmzLogAdd(rpmzLog zlog, char *fmt, ...) @@ -113,12 +118,12 @@ me->next = NULL; /*...@=mustfreeonly@*/ -assert(zlog->use != NULL); - yarnPossess(zlog->use); +assert(zlog->_item.use != NULL); + yarnPossess(zlog->_item.use); *zlog->msg_tail = me; zlog->msg_tail = &me->next; zlog->msg_count++; - yarnRelease(zlog->use); + yarnRelease(zlog->_item.use); } /** @@ -136,16 +141,16 @@ if (fp == NULL) fp = stderr; - yarnPossess(zlog->use); + yarnPossess(zlog->_item.use); if (zlog->msg_tail == NULL || (me = zlog->msg_head) == NULL) { - yarnRelease(zlog->use); + yarnRelease(zlog->_item.use); return 0; } zlog->msg_head = me->next; if (me->next == NULL) zlog->msg_tail = &zlog->msg_head; zlog->msg_count--; - yarnRelease(zlog->use); + yarnRelease(zlog->_item.use); diff.tv_usec = me->when.tv_usec - zlog->start.tv_usec; diff.tv_sec = me->when.tv_sec - zlog->start.tv_sec; @@ -169,8 +174,8 @@ if (zlog == NULL) return NULL; - yarnPossess(zlog->use); - nrefs = yarnPeekLock(zlog->use); + yarnPossess(zlog->_item.use); + nrefs = yarnPeekLock(zlog->_item.use); if (_rpmzlog_debug) fprintf(stderr, " -- zlog %p[%ld]\n", zlog, nrefs); #ifdef NOTYET @@ -180,7 +185,7 @@ fprintf(stderr, "==> FIXME: %s: zlog %p[%ld]\n", __FUNCTION__, zlog, nrefs); #endif if (nrefs == 1) { - yarnLock use = zlog->use; + yarnLock use = zlog->_item.use; if (zlog->msg_tail != NULL) { while ((me = zlog->msg_head) != NULL) { zlog->msg_head = me->next; @@ -203,7 +208,7 @@ yarnTwist(use, BY, -1); use = yarnFreeLock(use); } else - yarnTwist(zlog->use, BY, -1); + yarnTwist(zlog->_item.use, BY, -1); return NULL; } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmzlog.h ============================================================================ $ cvs diff -u -r2.3.2.3 -r2.3.2.4 rpmzlog.h --- rpm/rpmio/rpmzlog.h 20 Mar 2009 19:13:24 -0000 2.3.2.3 +++ rpm/rpmio/rpmzlog.h 25 Mar 2009 20:11:21 -0000 2.3.2.4 @@ -24,16 +24,17 @@ /** trace log */ struct rpmzLog_s { - yarnLock use; /*!< use count -- return to pool when zero */ -/*...@shared@*/ /*...@null@*/ - void *pool; /*!< pool (or NULL if malloc'd) */ - + struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ struct timeval start; /*!< starting time of day for tracing */ /*...@null@*/ rpmzMsg msg_head; /*...@shared@*/ /*...@relnull@*/ rpmzMsg *msg_tail; int msg_count; +#if defined(__LCLINT__) +/*...@refs@*/ + int nrefs; /*!< (unused) keep splint happy */ +#endif }; #endif /* _RPMZLOG_INTERNAL */ @@ -44,15 +45,15 @@ /** * Reference the log data. */ -/*...@newref@*/ -rpmzLog rpmzLogLink(/*...@returned@*/ /*...@null@*/ rpmzLog zlog) +/*...@newref@*/ /*...@null@*/ +rpmzLog rpmzLogLink(/*...@null@*/ rpmzLog zlog) /*...@globals fileSystem, internalState @*/ - /*...@modifies fileSystem, internalState @*/; + /*...@modifies zlog, fileSystem, internalState @*/; /** * Set up log (call from main thread before other threads launched). */ -/*...@only@*/ +/*...@newref@*/ rpmzLog rpmzLogNew(/*...@null@*/ struct timeval *tv) /*...@globals fileSystem, internalState @*/ /*...@modifies fileSystem, internalState @*/; @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org