|
From: <sv...@va...> - 2014-08-18 19:00:05
|
Author: florian
Date: Mon Aug 18 18:59:57 2014
New Revision: 14309
Log:
Inline VTS__show in VtsID__pp eliminating the fixed size
buffer along the way.
Modified:
branches/BUF_REMOVAL/helgrind/libhb_core.c
Modified: branches/BUF_REMOVAL/helgrind/libhb_core.c
==============================================================================
--- branches/BUF_REMOVAL/helgrind/libhb_core.c (original)
+++ branches/BUF_REMOVAL/helgrind/libhb_core.c Mon Aug 18 18:59:57 2014
@@ -1916,9 +1916,6 @@
Returns -1, 0 or 1. */
static Word VTS__cmp_structural ( VTS* a, VTS* b );
-/* Debugging only. Display the given VTS in the buffer. */
-static void VTS__show ( HChar* buf, Int nBuf, VTS* vts );
-
/* Debugging only. Return vts[index], so to speak. */
static ULong VTS__indexAt_SLOW ( VTS* vts, Thr* idx );
@@ -2381,38 +2378,6 @@
}
-/* Debugging only. Display the given VTS in the buffer.
-*/
-void VTS__show ( HChar* buf, Int nBuf, VTS* vts )
-{
- ScalarTS* st;
- HChar unit[64];
- Word i, n;
- Int avail = nBuf;
- tl_assert(vts && vts->ts);
- tl_assert(nBuf > 16);
- buf[0] = '[';
- buf[1] = 0;
- n = vts->usedTS;
- for (i = 0; i < n; i++) {
- tl_assert(avail >= 40);
- st = &vts->ts[i];
- VG_(memset)(unit, 0, sizeof(unit));
- VG_(sprintf)(unit, i < n-1 ? "%u:%llu " : "%u:%llu",
- st->thrid, (ULong)st->tym);
- if (avail < VG_(strlen)(unit) + 40/*let's say*/) {
- VG_(strcat)(buf, " ...]");
- buf[nBuf-1] = 0;
- return;
- }
- VG_(strcat)(buf, unit);
- avail -= VG_(strlen)(unit);
- }
- VG_(strcat)(buf, "]");
- buf[nBuf-1] = 0;
-}
-
-
/* Debugging only. Return vts[index], so to speak.
*/
ULong VTS__indexAt_SLOW ( VTS* vts, Thr* idx )
@@ -3209,11 +3174,19 @@
}
static void VtsID__pp ( VtsID vi ) {
- HChar buf[100];
VTS* vts = VtsID__to_VTS(vi);
- VTS__show( buf, sizeof(buf)-1, vts );
- buf[sizeof(buf)-1] = 0;
- VG_(printf)("%s", buf);
+ ScalarTS* st;
+ Word i, n;
+ tl_assert(vts && vts->ts);
+
+ VG_(printf)("[");
+ n = vts->usedTS;
+ for (i = 0; i < n; i++) {
+ st = &vts->ts[i];
+ VG_(printf)(i < n-1 ? "%u:%llu " : "%u:%llu",
+ st->thrid, (ULong)st->tym);
+ }
+ VG_(printf)("]");
}
/* compute partial ordering relation of vi1 and vi2. */
|