summaryrefslogtreecommitdiff
path: root/lib/header.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-12-08 19:04:50 +0000
committerjbj <devnull@localhost>1999-12-08 19:04:50 +0000
commitbd109d5df5c914b3b3897d0344d61bf28e2aacb9 (patch)
treeda332c49540b9dda67437ec31efeffba1e6cb60c /lib/header.c
parent132bdc063e023b2473056935f3f0dc182e79ecbe (diff)
downloadlibrpm-tizen-bd109d5df5c914b3b3897d0344d61bf28e2aacb9.tar.gz
librpm-tizen-bd109d5df5c914b3b3897d0344d61bf28e2aacb9.tar.bz2
librpm-tizen-bd109d5df5c914b3b3897d0344d61bf28e2aacb9.zip
rename new FILENAMES tags to BASENAMES/DIRNAMES/DIRINDEXES.
CVS patchset: 3466 CVS date: 1999/12/08 19:04:50
Diffstat (limited to 'lib/header.c')
-rw-r--r--lib/header.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/header.c b/lib/header.c
index 7b0558004..da38b76a5 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -106,6 +106,54 @@ struct sprintfToken {
} u;
};
+#if HAVE_MCHECK_H
+static int probe_headers = 0;
+#define HEADERPROBE(_h, _msg) if (probe_headers) headerProbe((_h), (_msg))
+
+static void headerProbeAddr(Header h, const char * msg,
+ void * p, const char * imsg)
+{
+ const char * mchkstr = NULL;
+ switch (mprobe(p)) {
+ case MCHECK_DISABLED:
+ case MCHECK_OK:
+ return;
+ /*@notreached@*/ break;
+ case MCHECK_HEAD:
+ mchkstr = "HEAD";
+ break;
+ case MCHECK_TAIL:
+ mchkstr = "TAIL";
+ break;
+ case MCHECK_FREE:
+ mchkstr = "FREE";
+ break;
+ }
+ fprintf(stderr, "*** MCHECK_%s h %p", mchkstr, h);
+ if (imsg && p)
+ fprintf(stderr, " %s %p", imsg, p);
+ if (msg)
+ fprintf(stderr, " %s", msg);
+ fprintf(stderr, "\n");
+}
+
+static void headerProbe(Header h, const char *msg)
+{
+ char imsg[256];
+ int i;
+
+ headerProbeAddr(h, msg, h, "header");
+ sprintf(imsg, "index (used %d)", h->indexUsed);
+ headerProbeAddr(h, msg, h->index, imsg);
+ for (i = 0; i < h->indexUsed; i++) {
+ sprintf(imsg, "index[%d:%d].data", i, h->indexUsed);
+ headerProbeAddr(h, msg, h->index[i].data, imsg);
+ }
+}
+#else /* HAVE_MCHECK_H */
+#define HEADERPROBE(_h, _msg)
+#endif /* HAVE_MCHECK_H */
+
static void copyEntry(struct indexEntry * entry, /*@out@*/ int_32 * type,
/*@out@*/ void ** p, /*@out@*/ int_32 * c, int minimizeMemory)
{
@@ -956,6 +1004,7 @@ static int intGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type,
struct indexEntry * entry;
char * chptr;
+ HEADERPROBE(h, "intGetEntry");
/* First find the tag */
entry = findEntry(h, tag, RPM_NULL_TYPE);
if (!entry) {
@@ -1023,6 +1072,7 @@ void headerFree(Header h)
Header headerLink(Header h)
{
+ HEADERPROBE(h, "headerLink");
h->usageCount++;
return h;
}