Remove obsolete files.

This commit is contained in:
kristerw 2002-03-11 18:57:50 +00:00
parent 175b5054de
commit dbe85b35bd
3 changed files with 0 additions and 828 deletions

View File

@ -1,274 +0,0 @@
Tue Sep 15 00:36:15 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* patchlevel.h: PATCHLEVEL 12u8.
Mon Sep 14 22:01:23 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* Makefile.SH: Add uninstall target. Simplify install target.
* util.c (fatal, pfatal): Add some asterisks to make fatal
messages stand out more.
Tue Aug 25 22:13:36 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* patch.c (main, get_some_switches), common.h, inp.c (plan_a,
plan_b), pch.c (there_is_another_aptch): Add -t option,
similar to -f.
Mon Jul 27 11:27:07 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* inp.c (plan_a, util.c (fetchname): Use a macro to simplify code.
* common.h: Define SCCSDIFF and RCSDIFF.
* inp.c (plan_a): Use them to make sure it's safe to check out
the default RCS or SCCS version.
From Paul Eggert.
Wed Jul 22 14:37:08 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* patch.man: Use the standard comment syntax -- '\" -- instead
of '''.
Tue Jul 21 15:26:01 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* Configure: Add /etc /usr/lib /lib to pth.
Mon Jul 20 14:10:32 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* util.h: Declare basename.
* inp.c (plan_a), util.c (fetchname): Use it to isolate the
leading path when testing for RCS and SCCS files.
Sat Jul 11 18:03:26 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* Configure: Use the user's PATH and build pth from it.
Fri Jul 10 16:03:23 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* Configure: Change cc -S to cc -c and tr '[ - ]' '[\012-\012]'
to tr ' ' '\012' for AIX 3.2.
From chip@tct.com (Chip Salzenberg).
* util.c (makedirs): Only make the directories that don't exist.
From chip@tct.com (Chip Salzenberg).
Wed Jul 8 01:21:15 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* util.c (fatal, pfatal): Print "patch: " before message.
* pch.c, inp.c, patch.c, util.c: Remove "patch: " from the
callers that had it.
* util.c (pfatal): New function.
* util.h: Declare it and pfatal[1-4] macros.
* various files: Use it instead of fatal where appropriate.
* Configure: Make /usr/local/man/man1 the first choice for the
man pages.
* patch.c (main): Open ofp after checking for ed script.
Close ofp and rejfp before trying plan B.
From epang@sfu.ca (Eugene Pang).
* backupfile.h: Declare get_version.
* Move decls of rindex and popen to common.h.
* common.h (myuid): New variable.
* patch.c (main): Initialize it.
* inp.c (myuid): Function removed.
(plan_a): Use the variable, not the function.
* patch.c: Reinstate -E option.
Tue Jul 7 23:19:28 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* inp.c (myuid): New function.
(plan_a): Call it. Optimize stat calls. Be smarter about
detecting checked out RCS and SCCS files.
From Paul Eggert (eggert@twinsun.com).
* inp.c, util.c, patch.c: Don't bother checking for stat() > 0.
Mon Jul 6 13:01:52 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* version.c (version): Don't print the RCS stuff, since we're
not updating it regularly.
* patch.c (get_some_switches): Make the usage message more accurate.
* patchlevel.h: PATCHLEVEL 12u7.
* Makefile.SH (dist): New target.
Makedist: File removed.
* inp.c (plan_a): Check whether the user can write to the
file, not whether anyone can write to the file.
Sat Jul 4 00:06:58 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* inp.c (plan_a): Try to check out read-only files from RCS or SCCS.
* util.c (move_file): If backing up by linking fails, try copying.
From cek@sdc.boeing.com (Conrad Kimball).
* patch.c (get_some_switches): Eliminate -E option; always
remove empty output files.
* util.c (fetchname): Only undo slash removal for relative
paths if -p was not given.
* Makefile.sh: Add mostlyclean target.
Fri Jul 3 23:48:14 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
* util.c (fetchname): Accept whitespace between `Index:' and filename.
Also plug a small memory leak for diffs against /dev/null.
From eggert@twinsun.com (Paul Eggert).
* common.h: Don't define TRUE and FALSE if already defined.
From phk@data.fls.dk (Poul-Henning Kamp).
Wed Apr 29 10:19:33 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu)
* backupfile.c (get_version): Exit if given a bad backup type.
Fri Mar 27 09:57:14 1992 Karl Berry (karl at hayley)
* common.h (S_ISDIR, S_ISREG): define these.
* inp.c (plan_a): use S_ISREG, not S_IFREG.
* util.c (fetchname): use S_ISDIR, not S_IFDIR.
Mon Mar 16 14:10:42 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu)
* patchlevel.h: PATCHLEVEL 12u6.
Sat Mar 14 13:13:29 1992 David J. MacKenzie (djm at frob.eng.umd.edu)
* Configure, config.h.SH: Check for directory header and unistd.h.
* patch.c (main): If -E was given and output file is empty after
patching, remove it.
(get_some_switches): Recognize -E option.
* patch.c (copy_till): Make garbled output an error, not a warning
that doesn't change the exit status.
* common.h: Protect against system declarations of malloc and realloc.
* Makedist: Add backupfile.[ch].
* Configure: Look for C library where NeXT and SVR4 put it.
Look in /usr/ucb after /bin and /usr/bin for utilities,
and look in /usr/ccs/bin, to make SVR4 happier.
Recognize m68k predefine.
* util.c (fetchname): Test of stat return value was backward.
From csss@scheme.cs.ubc.ca.
* version.c (version): Exit with status 0, not 1.
* Makefile.SH: Add backupfile.[cho].
* patch.c (main): Initialize backup file generation.
(get_some_switches): Add -V option.
* common.h, util,c, patch.c: Replace origext with simple_backup_suffix.
* util.c (move_file): Use find_backup_file_name.
Tue Dec 3 11:27:16 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu)
* patchlevel.h: PATCHLEVEL 12u5.
* Makefile.SH: Change clean, distclean, and realclean targets a
little so they agree with the GNU coding standards.
Add Makefile to addedbyconf, so distclean removes it.
* Configure: Recognize Domain/OS C library in /lib/libc.
From mmuegel@mot.com (Michael S. Muegel).
* pch.c: Fixes from Wayne Davison:
Patch now accepts no-context context diffs that are
specified with an assumed one line hunk (e.g. "*** 10 ****").
Fixed a bug in both context and unified diff processing that would
put a zero-context hunk in the wrong place (one line too soon).
Fixed a minor problem with p_max in unified diffs where it would
set p_max to hunkmax unnecessarily (the only adverse effect was to
not supply empty lines at eof by assuming they were truncated).
Tue Jul 2 03:25:51 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu)
* Configure: Check for signal declaration in
/usr/include/sys/signal.h as well as /usr/include/signal.h.
* Configure, common.h, config.h.SH: Comment out the sprintf
declaration and tests to determine its return value type. It
conflicts with ANSI C systems' prototypes in stdio.h and the
return value of sprintf is never used anyway -- it's always cast
to void.
Thu Jun 27 13:05:32 1991 David J. MacKenzie (djm at churchy.gnu.ai.mit.edu)
* patchlevel.h: PATCHLEVEL 12u4.
Thu Feb 21 15:18:14 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
* pch.c (another_hunk): Fix off by 1 error. From
iverson@xstor.com (Tim Iverson).
Sun Jan 20 20:18:58 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
* Makefile.SH (all): Don't make a dummy `all' file.
* patchlevel.h: PATCHLEVEL 12u3.
* patch.c (nextarg): New function.
(get_some_switches): Use it, to prevent dereferencing a null
pointer if an option that takes an arg is not given one (is last
on the command line). From Paul Eggert.
* pch.c (another_hunk): Fix from Wayne Davison to recognize
single-line hunks in unified diffs (with a single line number
instead of a range).
* inp.c (rev_in_string): Don't use `s' before defining it. From
Wayne Davison.
Mon Jan 7 06:25:11 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
* patchlevel.h: PATCHLEVEL 12u2.
* pch.c (intuit_diff_type): Recognize `+++' in diff headers, for
unified diff format. From unidiff patch 1.
Mon Dec 3 00:14:25 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
* patch.c (get_some_switches): Make the usage message more
informative.
Sun Dec 2 23:20:18 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
* Configure: When checking for C preprocessor, look for 'abc.*xyz'
instead of 'abc.xyz', so ANSI C preprocessors work.
* Apply fix for -D from ksb@mentor.cc.purdue.edu (Kevin Braunsdorf).
* Apply unidiff patches from davison@dri.com (Wayne Davison).
Wed Mar 7 23:47:25 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
* pch.c: Call malformed instead of goto malformed
(just allows easier debugging).
Tue Jan 23 21:27:00 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
* common.h (TMP*NAME): Make these char *, not char [].
patch.c (main): Use TMPDIR (if present) to set TMP*NAME.
common.h: Declare getenv.
Sun Dec 17 17:29:48 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
* patch.c (reverse_flag_specified): New variable.
(get_some_switches, reinitialize_almost_everything): Use it.
Local Variables:
mode: indented-text
left-margin: 8
version-control: never
end:

View File

@ -1,85 +0,0 @@
/* $NetBSD: config.h,v 1.5 2002/03/08 21:57:33 kristerw Exp $ */
/* config.h
* This file was produced by running the config.h.SH script, which
* gets its values from config.sh, which is generally produced by
* running Configure.
*
* Feel free to modify any of this as the need arises. Note, however,
* that running config.h.SH again will wipe out any changes you've made.
* For a more permanent change edit config.sh and rerun config.h.SH.
*/
/* EUNICE:
* This symbol, if defined, indicates that the program is being compiled
* under the EUNICE package under VMS. The program will need to handle
* things like files that don't go away the first time you unlink them,
* due to version numbering. It will also need to compensate for lack
* of a respectable link() command.
*/
/* VMS:
* This symbol, if defined, indicates that the program is running under
* VMS. It is currently only set in conjunction with the EUNICE symbol.
*/
#undef EUNICE
#undef VMS
/* CPPSTDIN:
* This symbol contains the first part of the string which will invoke
* the C preprocessor on the standard input and produce to standard
* output. Typical value of "cc -E" or "/lib/cpp".
*/
/* CPPMINUS:
* This symbol contains the second part of the string which will invoke
* the C preprocessor on the standard input and produce to standard
* output. This symbol will have the value "-" if CPPSTDIN needs a minus
* to specify standard input, otherwise the value is "".
*/
#define CPPSTDIN "/usr/bin/cpp"
#define CPPMINUS ""
/* CHARSPRINTF:
* This symbol is defined if this system declares "char *sprintf()" in
* stdio.h. The trend seems to be to declare it as "int sprintf()". It
* is up to the package author to declare sprintf correctly based on the
* symbol.
*/
#undef CHARSPRINTF
/* FLEXFILENAMES:
* This symbol, if defined, indicates that the system supports filenames
* longer than 14 characters.
*/
#define FLEXFILENAMES
/* index:
* This preprocessor symbol is defined, along with rindex, if the system
* uses the strchr and strrchr routines instead.
*/
/* rindex:
* This preprocessor symbol is defined, along with index, if the system
* uses the strchr and strrchr routines instead.
*/
#if 0
#define index strchr /* cultural */
#define rindex strrchr /* differences? */
#endif
/* VOIDSIG:
* This symbol is defined if this system declares "void (*signal())()" in
* signal.h. The old way was to declare it as "int (*signal())()". It
* is up to the package author to declare things correctly based on the
* symbol.
*/
#define VOIDSIG /**/
/* DIRHEADER:
* This definition indicates which directory library header to use.
*/
#define DIRENT
/* HAVE_UNISTD_H:
* This is defined if the system has unistd.h.
*/
#define HAVE_UNISTD_H /**/

View File

@ -1,469 +0,0 @@
/* $NetBSD: malloc.c,v 1.3 1996/09/19 06:27:11 thorpej Exp $ */
/*
* from: @(#)nmalloc.c 1 (Caltech) 2/21/82
*
* U of M Modified: 20 Jun 1983 ACT: strange hacks for Emacs
*
* Nov 1983, Mike@BRL, Added support for 4.1C/4.2 BSD.
*
* This is a very fast storage allocator. It allocates blocks of a small
* number of different sizes, and keeps free lists of each size. Blocks
* that don't exactly fit are passed up to the next larger size. In this
* implementation, the available sizes are (2^n)-4 (or -16) bytes long.
* This is designed for use in a program that uses vast quantities of
* memory, but bombs when it runs out. To make it a little better, it
* warns the user when he starts to get near the end.
*
* June 84, ACT: modified rcheck code to check the range given to malloc,
* rather than the range determined by the 2-power used.
*
* Jan 85, RMS: calls malloc_warning to issue warning on nearly full.
* No longer Emacs-specific; can serve as all-purpose malloc for GNU.
* You should call malloc_init to reinitialize after loading dumped Emacs.
* Call malloc_stats to get info on memory stats if MSTATS turned on.
* realloc knows how to return same block given, just changing its size,
* if the power of 2 is correct.
*/
/*
* nextf[i] is the pointer to the next free block of size 2^(i+3). The
* smallest allocatable block is 8 bytes. The overhead information will
* go in the first int of the block, and the returned pointer will point
* to the second.
*
#ifdef MSTATS
* nmalloc[i] is the difference between the number of mallocs and frees
* for a given block size.
#endif /* MSTATS */
*/
#define ISALLOC ((char) 0xf7) /* magic byte that implies allocation */
#define ISFREE ((char) 0x54) /* magic byte that implies free block */
/* this is for error checking only */
extern char etext;
/* end of the program; can be changed by calling init_malloc */
static char *endofpure = &etext;
#ifdef MSTATS
static int nmalloc[30];
static int nmal, nfre;
#endif /* MSTATS */
/* If range checking is not turned on, all we have is a flag indicating
whether memory is allocated, an index in nextf[], and a size field; to
realloc() memory we copy either size bytes or 1<<(index+3) bytes depending
on whether the former can hold the exact size (given the value of
'index'). If range checking is on, we always need to know how much space
is allocated, so the 'size' field is never used. */
struct mhead {
char mh_alloc; /* ISALLOC or ISFREE */
char mh_index; /* index in nextf[] */
/* Remainder are valid only when block is allocated */
unsigned short mh_size; /* size, if < 0x10000 */
#ifdef rcheck
unsigned mh_nbytes; /* number of bytes allocated */
int mh_magic4; /* should be == MAGIC4 */
#endif /* rcheck */
};
/* Access free-list pointer of a block.
It is stored at block + 4.
This is not a field in the mhead structure
because we want sizeof (struct mhead)
to describe the overhead for when the block is in use,
and we do not want the free-list pointer to count in that. */
#define CHAIN(a) \
(*(struct mhead **) (sizeof (char *) + (char *) (a)))
#ifdef rcheck
/* To implement range checking, we write magic values in at the beginning and
end of each allocated block, and make sure they are undisturbed whenever a
free or a realloc occurs. */
/* Written in each of the 4 bytes following the block's real space */
#define MAGIC1 0x55
/* Written in the 4 bytes before the block's real space */
#define MAGIC4 0x55555555
#define ASSERT(p) if (!(p)) botch("p"); else
static
botch(s)
char *s;
{
printf("assertion botched: %s\n", s);
abort();
}
#define EXTRA 4 /* 4 bytes extra for MAGIC1s */
#else
#define ASSERT(p)
#define EXTRA 0
#endif /* rcheck */
/* nextf[i] is free list of blocks of size 2**(i + 3) */
static struct mhead *nextf[30];
#ifdef M_WARN
/* Number of bytes of writable memory we can expect to be able to get */
static int lim_data;
/* Level number of warnings already issued.
0 -- no warnings issued.
1 -- 75% warning already issued.
2 -- 85% warning already issued.
*/
static int warnlevel;
#endif /* M_WARN */
/* nonzero once initial bunch of free blocks made */
static int gotpool;
/* Cause reinitialization based on job parameters;
also declare where the end of pure storage is. */
malloc_init (end)
char *end; {
endofpure = end;
#ifdef M_WARN
lim_data = 0;
warnlevel = 0;
#endif /* M_WARN */
}
static
morecore (nu) /* ask system for more memory */
register int nu; { /* size index to get more of */
char *sbrk ();
register char *cp;
register int nblks;
register int siz;
#ifdef M_WARN
#ifndef BSD42
#ifdef USG
extern long ulimit ();
if (lim_data == 0) /* find out how much we can get */
lim_data = ulimit (3, 0) - TEXT_START;
#else /*HMS: was endif */
if (lim_data == 0) /* find out how much we can get */
lim_data = vlimit (LIM_DATA, -1);
#endif /* USG */ /HMS:* was not here */
#else
if (lim_data == 0) {
struct rlimit XXrlimit;
getrlimit (RLIMIT_DATA, &XXrlimit);
lim_data = XXrlimit.rlim_cur;} /* soft limit */
#endif /* BSD42 */
#endif /* M_WARN */
/* On initial startup, get two blocks of each size up to 1k bytes */
if (!gotpool)
getpool (), getpool (), gotpool = 1;
/* Find current end of memory and issue warning if getting near max */
cp = sbrk (0);
siz = cp - endofpure;
#ifdef M_WARN
switch (warnlevel) {
case 0:
if (siz > (lim_data / 4) * 3) {
warnlevel++;
malloc_warning ("Warning: past 75% of memory limit");}
break;
case 1:
if (siz > (lim_data / 20) * 17) {
warnlevel++;
malloc_warning ("Warning: past 85% of memory limit");}
break;
case 2:
if (siz > (lim_data / 20) * 19) {
warnlevel++;
malloc_warning ("Warning: past 95% of memory limit");}
break;}
#endif /* M_WARN */
if ((int) cp & 0x3ff) /* land on 1K boundaries */
sbrk (1024 - ((int) cp & 0x3ff));
/* Take at least 2k, and figure out how many blocks of the desired size we're about to get */
nblks = 1;
if ((siz = nu) < 8)
nblks = 1 << ((siz = 8) - nu);
if ((cp = sbrk (1 << (siz + 3))) == (char *) -1)
return; /* no more room! */
if ((int) cp & 7) { /* shouldn't happen, but just in case */
cp = (char *) (((int) cp + 8) & ~7);
nblks--;}
/* save new header and link the nblks blocks together */
nextf[nu] = (struct mhead *) cp;
siz = 1 << (nu + 3);
while (1) {
((struct mhead *) cp) -> mh_alloc = ISFREE;
((struct mhead *) cp) -> mh_index = nu;
if (--nblks <= 0) break;
CHAIN ((struct mhead *) cp) = (struct mhead *) (cp + siz);
cp += siz;}
/* CHAIN ((struct mhead *) cp) = 0; /* since sbrk() returns cleared core, this is already set */
}
static
getpool () {
register int nu;
register char *cp = sbrk (0);
if ((int) cp & 0x3ff) /* land on 1K boundaries */
sbrk (1024 - ((int) cp & 0x3ff));
/* Get 2k of storage */
cp = sbrk (04000);
if (cp == (char *) -1)
return;
/* Divide it into an initial 8-word block
plus one block of size 2**nu for nu = 3 ... 10. */
CHAIN (cp) = nextf[0];
nextf[0] = (struct mhead *) cp;
((struct mhead *) cp) -> mh_alloc = ISFREE;
((struct mhead *) cp) -> mh_index = 0;
cp += 8;
for (nu = 0; nu < 7; nu++) {
CHAIN (cp) = nextf[nu];
nextf[nu] = (struct mhead *) cp;
((struct mhead *) cp) -> mh_alloc = ISFREE;
((struct mhead *) cp) -> mh_index = nu;
cp += 8 << nu;}}
char *
malloc (n) /* get a block */
unsigned n; {
register struct mhead *p;
register unsigned int nbytes;
register int nunits = 0;
/* Figure out how many bytes are required, rounding up to the nearest
multiple of 4, then figure out which nextf[] area to use */
nbytes = (n + sizeof *p + EXTRA + 3) & ~3;
{
register unsigned int shiftr = (nbytes - 1) >> 2;
while (shiftr >>= 1)
nunits++;
}
/* If there are no blocks of the appropriate size, go get some */
/* COULD SPLIT UP A LARGER BLOCK HERE ... ACT */
if (nextf[nunits] == 0)
morecore (nunits);
/* Get one block off the list, and set the new list head */
if ((p = nextf[nunits]) == 0)
return 0;
nextf[nunits] = CHAIN (p);
/* Check for free block clobbered */
/* If not for this check, we would gobble a clobbered free chain ptr */
/* and bomb out on the NEXT allocate of this size block */
if (p -> mh_alloc != ISFREE || p -> mh_index != nunits)
#ifdef rcheck
botch ("block on free list clobbered");
#else
abort ();
#endif /* rcheck */
/* Fill in the info, and if range checking, set up the magic numbers */
p -> mh_alloc = ISALLOC;
#ifdef rcheck
p -> mh_nbytes = n;
p -> mh_magic4 = MAGIC4;
{
register char *m = (char *) (p + 1) + n;
*m++ = MAGIC1, *m++ = MAGIC1, *m++ = MAGIC1, *m = MAGIC1;
}
#else
p -> mh_size = n;
#endif /* rcheck */
#ifdef MSTATS
nmalloc[nunits]++;
nmal++;
#endif /* MSTATS */
return (char *) (p + 1);}
free (mem)
char *mem; {
register struct mhead *p;
{
register char *ap = mem;
ASSERT (ap != 0);
p = (struct mhead *) ap - 1;
ASSERT (p -> mh_alloc == ISALLOC);
#ifdef rcheck
ASSERT (p -> mh_magic4 == MAGIC4);
ap += p -> mh_nbytes;
ASSERT (*ap++ == MAGIC1); ASSERT (*ap++ == MAGIC1);
ASSERT (*ap++ == MAGIC1); ASSERT (*ap == MAGIC1);
#endif /* rcheck */
}
{
register int nunits = p -> mh_index;
ASSERT (nunits <= 29);
p -> mh_alloc = ISFREE;
CHAIN (p) = nextf[nunits];
nextf[nunits] = p;
#ifdef MSTATS
nmalloc[nunits]--;
nfre++;
#endif /* MSTATS */
}
}
char *
realloc (mem, n)
char *mem;
register unsigned n; {
register struct mhead *p;
register unsigned int tocopy;
register int nbytes;
register int nunits;
if ((p = (struct mhead *) mem) == 0)
return malloc (n);
p--;
nunits = p -> mh_index;
ASSERT (p -> mh_alloc == ISALLOC);
#ifdef rcheck
ASSERT (p -> mh_magic4 == MAGIC4);
{
register char *m = mem + (tocopy = p -> mh_nbytes);
ASSERT (*m++ == MAGIC1); ASSERT (*m++ == MAGIC1);
ASSERT (*m++ == MAGIC1); ASSERT (*m == MAGIC1);
}
#else
if (p -> mh_index >= 13)
tocopy = (1 << (p -> mh_index + 3)) - sizeof *p;
else
tocopy = p -> mh_size;
#endif /* rcheck */
/* See if desired size rounds to same power of 2 as actual size. */
nbytes = (n + sizeof *p + EXTRA + 7) & ~7;
/* If ok, use the same block, just marking its size as changed. */
if (nbytes > (4 << nunits) && nbytes <= (8 << nunits)) {
#ifdef rcheck
register char *m = mem + tocopy;
*m++ = 0; *m++ = 0; *m++ = 0; *m++ = 0;
p-> mh_nbytes = n;
m = mem + n;
*m++ = MAGIC1; *m++ = MAGIC1; *m++ = MAGIC1; *m++ = MAGIC1;
#else
p -> mh_size = n;
#endif /* rcheck */
return mem;}
if (n < tocopy)
tocopy = n;
{
register char *new;
void bcopy(); /*HMS: here? */
if ((new = malloc (n)) == 0)
return 0;
bcopy (mem, new, tocopy);
free (mem);
return new;
}
}
#ifdef MSTATS
/* Return statistics describing allocation of blocks of size 2**n. */
struct mstats_value {
int blocksize;
int nfree;
int nused;
};
struct mstats_value
malloc_stats (size)
int size; {
struct mstats_value v;
register int i;
register struct mhead *p;
v.nfree = 0;
if (size < 0 || size >= 30) {
v.blocksize = 0;
v.nused = 0;
return v;}
v.blocksize = 1 << (size + 3);
v.nused = nmalloc[size];
for (p = nextf[size]; p; p = CHAIN (p))
v.nfree++;
return v;}
#endif
/* how much space is available? */
unsigned freespace() {
register int i, j;
register struct mhead *p;
register unsigned space = 0;
int local; /* address only is used */
space = (char *)&local - sbrk(0); /* stack space */
for (i = 0; i < 30; i++) {
for (j = 0, p = nextf[i]; p; p = CHAIN (p), j++) ;
space += j * (1 << (i + 3));}
return(space);}
/* How big is this cell? */
unsigned mc_size(cp)
char *cp;{
register struct mhead *p;
if ((p = (struct mhead *) cp) == 0) {
/*HMS? */
}
p--;
#ifdef rcheck
return p -> mh_nbytes;
#else
return (1 << (p -> mh_index + 3)) - sizeof *p;
/**/
/* if (p -> mh_index >= 13)
/* return (1 << (p -> mh_index + 3)) - sizeof *p;
/* else
/* return p -> mh_size;
/**/
#endif /* rcheck */
}
/*HMS: Really should use memcpy, if available... */
void bcopy(source, dest, len)
register char *source, *dest;
register len; {
register i;
for (i = 0; i < len; i++)
*dest++ = *source++;}