X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=rpmdb%2Fheader_internal.c;h=969ca1114b6e69d9223ba31352bbf551aed3acb8;hb=c2e3cde667fc1345e33535ac9e1feb5b437602ec;hp=9d81c7e0a9dc4a295019b20f9a2a8ce0c775a397;hpb=98ca8eff8d1d0f25201554a849d2fe9fdd271055;p=platform%2Fupstream%2Frpm.git diff --git a/rpmdb/header_internal.c b/rpmdb/header_internal.c index 9d81c7e..969ca11 100644 --- a/rpmdb/header_internal.c +++ b/rpmdb/header_internal.c @@ -172,3 +172,22 @@ void headerDump(Header h, FILE *f, int flags, /*@=type@*/ /*@=sizeoftype@*/ /*@=boundsread@*/ + +char * bin2hex(const char *data, size_t size) +{ + static char hex[] = "0123456789abcdef"; + const char * s = data; + char * t, * val; + val = t = xmalloc(size * 2 + 1); + while (size-- > 0) { + unsigned int i; + i = *s++; + *t++ = hex[ (i >> 4) & 0xf ]; + *t++ = hex[ (i ) & 0xf ]; + } + *t = '\0'; + + return val; +} + +