- if (memcmp(head, ptr - 8*sizeof(char), 8*sizeof(char)))
- {
- yaz_log(YLOG_FATAL, "xrealloc_d bad head, %s:%d, %p",
- file, line, ptr);
- abort();
- }
- dinfo = (struct dmalloc_info *) (ptr-8*sizeof(char) - sizeof(*dinfo));
- if (memcmp(ptr + dinfo->len, tail, 8*sizeof(char)))
- {
- yaz_log(YLOG_FATAL, "xrealloc_d bad tail, %s:%d, %p",
- file, line, ptr);
- abort();
- }
- if (dinfo->prev)
- dinfo->prev->next = dinfo->next;
- else
- dmalloc_list = dinfo->next;
- if (dinfo->next)
- dinfo->next->prev = dinfo->prev;
-
- if (!nbytes)
- {
- free (dinfo);
- return 0;
- }
- res = (char *)
- realloc(dinfo, nbytes + sizeof(*dinfo) + 16*sizeof(char));
+ if (memcmp(head, ptr - 8*sizeof(char), 8*sizeof(char)))
+ {
+ yaz_log(YLOG_FATAL, "xrealloc_d bad head, %s:%d, %p",
+ file, line, ptr);
+ abort();
+ }
+ dinfo = (struct dmalloc_info *) (ptr-8*sizeof(char) - sizeof(*dinfo));
+ if (memcmp(ptr + dinfo->len, tail, 8*sizeof(char)))
+ {
+ yaz_log(YLOG_FATAL, "xrealloc_d bad tail, %s:%d, %p",
+ file, line, ptr);
+ abort();
+ }
+ if (dinfo->prev)
+ dinfo->prev->next = dinfo->next;
+ else
+ dmalloc_list = dinfo->next;
+ if (dinfo->next)
+ dinfo->next->prev = dinfo->prev;
+
+ if (!nbytes)
+ {
+ free (dinfo);
+ return 0;
+ }
+ res = (char *)
+ realloc(dinfo, nbytes + sizeof(*dinfo) + 16*sizeof(char));