new pattern substitution replacement feature; fix for problem with unset builtin and associative arrays

This commit is contained in:
Chet Ramey
2021-10-08 08:21:16 -04:00
parent f188aa6a01
commit f74291e6d1
8 changed files with 82 additions and 23 deletions
+7 -9
View File
@@ -1344,27 +1344,25 @@ malloc_usable_size (mem)
{
register union mhead *p;
register char *ap;
register int maxbytes;
if ((ap = (char *)mem) == 0)
return 0;
/* Find the true start of the memory block to discover which bin */
p = (union mhead *) ap - 1;
if (p->mh_alloc == ISMEMALIGN)
{
ap -= p->mh_nbytes;
p = (union mhead *) ap - 1;
}
/* XXX - should we return 0 if ISFREE? */
maxbytes = binsize(p->mh_index);
/* So the usable size is the maximum number of bytes in the bin less the
malloc overhead */
maxbytes -= MOVERHEAD + MSLOP;
return (maxbytes);
/* return 0 if ISFREE */
if (p->mh_alloc == ISFREE)
return 0;
/* Since we use bounds checking, the usable size is the last requested size. */
return (p->mh_nbytes);
}
#if !defined (NO_VALLOC)