rpmzlog.c   rpmzlog.c 
skipping to change at line 56 skipping to change at line 56
#include "rpmzlog.h" #include "rpmzlog.h"
#include "debug.h" #include "debug.h"
/*@unchecked@*/ /*@unchecked@*/
static int _rpmzlog_debug = 0; static int _rpmzlog_debug = 0;
/*@access rpmzMsg @*/ /*@access rpmzMsg @*/
/*@access rpmzLog @*/ /*@access rpmzLog @*/
#ifdef __cplusplus
GENfree(rpmzMsg)
GENfree(rpmzLog)
#endif /* __cplusplus */
/*==============================================================*/ /*==============================================================*/
/* maximum log entry length */ /* maximum log entry length */
#define _RPMZLOG_MAXMSG 256 #define _RPMZLOG_MAXMSG 256
rpmzLog rpmzLogLink(rpmzLog zlog) rpmzLog rpmzLogLink(rpmzLog zlog)
{ {
long nrefs; long nrefs;
if (zlog == NULL) if (zlog == NULL)
skipping to change at line 77 skipping to change at line 82
yarnPossess(zlog->_item.use); yarnPossess(zlog->_item.use);
nrefs = yarnPeekLock(zlog->_item.use); nrefs = yarnPeekLock(zlog->_item.use);
if (_rpmzlog_debug) if (_rpmzlog_debug)
fprintf(stderr, " ++ zlog %p[%ld]\n", zlog, nrefs+1); fprintf(stderr, " ++ zlog %p[%ld]\n", zlog, nrefs+1);
yarnTwist(zlog->_item.use, BY, 1); yarnTwist(zlog->_item.use, BY, 1);
return zlog; return zlog;
} }
rpmzLog rpmzLogNew(struct timeval *tv) rpmzLog rpmzLogNew(struct timeval *tv)
{ {
rpmzLog zlog = xcalloc(1, sizeof(*zlog)); rpmzLog zlog = (rpmzLog) xcalloc(1, sizeof(*zlog));
zlog->_item.use = yarnNewLock(0); zlog->_item.use = yarnNewLock(0);
zlog->msg_head = NULL; zlog->msg_head = NULL;
zlog->msg_tail = &zlog->msg_head; zlog->msg_tail = &zlog->msg_head;
/* starting time for log entries */ /* starting time for log entries */
/*@-assignexpose@*/ /*@-assignexpose@*/
if (tv != NULL) if (tv != NULL)
zlog->start = *tv; /* structure assignment */ zlog->start = *tv; /* structure assignment */
else else
(void) gettimeofday(&zlog->start, NULL); (void) gettimeofday(&zlog->start, NULL);
/*@=assignexpose@*/ /*@=assignexpose@*/
/*@-nullret@*/ /*@-nullret@*/
return rpmzLogLink(zlog); return rpmzLogLink(zlog);
/*@=nullret@*/ /*@=nullret@*/
} }
void rpmzLogAdd(rpmzLog zlog, char *fmt, ...) void rpmzLogAdd(rpmzLog zlog, const char *fmt, ...)
{ {
rpmzMsg me; rpmzMsg me;
struct timeval now; struct timeval now;
va_list ap; va_list ap;
char msg[_RPMZLOG_MAXMSG]; char msg[_RPMZLOG_MAXMSG];
int xx; int xx;
if (zlog == NULL) if (zlog == NULL)
return; return;
xx = gettimeofday(&now, NULL); xx = gettimeofday(&now, NULL);
me = xmalloc(sizeof(*me)); me = (rpmzMsg) xmalloc(sizeof(*me));
me->when = now; me->when = now;
va_start(ap, fmt); va_start(ap, fmt);
xx = vsnprintf(msg, sizeof(msg)-1, fmt, ap); xx = vsnprintf(msg, sizeof(msg)-1, fmt, ap);
va_end(ap); va_end(ap);
msg[sizeof(msg)-1] = '\0'; msg[sizeof(msg)-1] = '\0';
/*@-mustfreeonly@*/ /*@-mustfreeonly@*/
me->msg = xmalloc(strlen(msg) + 1); me->msg = (char *) xmalloc(strlen(msg) + 1);
/*@=mustfreeonly@*/ /*@=mustfreeonly@*/
strcpy(me->msg, msg); strcpy(me->msg, msg);
/*@-mustfreeonly@*/ /*@-mustfreeonly@*/
me->next = NULL; me->next = NULL;
/*@=mustfreeonly@*/ /*@=mustfreeonly@*/
assert(zlog->_item.use != NULL); assert(zlog->_item.use != NULL);
yarnPossess(zlog->_item.use); yarnPossess(zlog->_item.use);
*zlog->msg_tail = me; *zlog->msg_tail = me;
zlog->msg_tail = &me->next; zlog->msg_tail = &me->next;
 End of changes. 5 change blocks. 
4 lines changed or deleted 9 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/