Older version of glibc and valgrind require a slight massage.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
state->last_vertex_offset = 0;
if (sna->render.vbo && !kgem_bo_can_map(&sna->kgem, sna->render.vbo)) {
- DBG(("%s: discarding vbo as next access will stall: %d\n",
- __FUNCTION__, sna->render.vbo->presumed_offset));
+ DBG(("%s: discarding vbo as next access will stall: %lx\n",
+ __FUNCTION__, (long)sna->render.vbo->presumed_offset));
discard_vbo(sna);
}
src_bo->pitch = stride;
kgem_bo_mark_unreusable(src_bo);
- DBG(("%s: upload(%d, %d, %d, %d) x %d through a temporary map\n",
- __FUNCTION__, x, y, w, h,
- RegionNumRects(region)));
+ DBG(("%s: upload(%d, %d, %d, %d) x %ld through a temporary map\n",
+ __FUNCTION__, x, y, w, h, (long)RegionNumRects(region)));
if (sigtrap_get() == 0) {
ok = sna->render.copy_boxes(sna, GXcopy,
sna->debug_memory.cpu_bo_allocs,
(long)sna->debug_memory.cpu_bo_bytes);
+#ifdef VALGRIND_DO_ADDED_LEAK_CHECK
VG(VALGRIND_DO_ADDED_LEAK_CHECK);
+#endif
}
#else
static char *canonical_mode_name(DisplayModePtr mode)
{
- char *str;
+ char tmp[32], *buf;
+ int len;
- if (asprintf(&str, "%dx%d%s",
- mode->HDisplay, mode->VDisplay,
- mode->Flags & V_INTERLACE ? "i" : "") < 0)
+ len = sprintf(tmp, "%dx%d%s",
+ mode->HDisplay, mode->VDisplay,
+ mode->Flags & V_INTERLACE ? "i" : "");
+ if ((unsigned)len >= sizeof(tmp))
return NULL;
- return str;
+ buf = malloc(len + 1);
+ if (buf == NULL)
+ return NULL;
+
+ return memcpy(buf, tmp, len + 1);
}
static DisplayModePtr