Kaydet (Commit) f2e51298 authored tarafından Jack Jansen's avatar Jack Jansen

reallocing large blocks now doesn't copy if not needed

üst 8239f0ff
......@@ -333,8 +333,21 @@ realloc(cp, nbytes)
*/
expensive = 0;
if ( i == 0xff ) {
expensive = 1;
/* Big block. See if it has to stay big */
if (nbytes+OVERHEAD > MAXMALLOC) {
/* Yup, try to resize it first */
SetPtrSize((Ptr)op, nbytes+OVERHEAD);
if ( MemError() == 0 ) {
#ifdef RCHECK
op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1);
*(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
#endif
return cp;
}
/* Nope, failed. Take the long way */
}
maxsize = GetPtrSize((Ptr)op);
expensive = 1;
} else {
maxsize = 1 << (i+3);
if ( nbytes + OVERHEAD > maxsize )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment