Article View: comp.sys.amiga.tech
Article #12095Re: ReallocMem
From: Usenet file owner
Date: Mon, 03 Apr 1989 21:34
Date: Mon, 03 Apr 1989 21:34
39 lines
1851 bytes
1851 bytes
In article <DEVEN.89Apr2223029@daniel.pawl.rpi.edu> shadow@pawl.rpi.edu (Deven T. Corzine) writes:
>In article <432@antares.UUCP> jms@antares.UUCP (Joe Smith) writes:
>And I stand by that statement. It remains a trivial task to write a
>proper ReallocMem for Exec. It would be about twice as complex as
>AllocMem, which I can't see being very complex, considering the
>simplicity of its task. Adding a ReallocMem to Exec has NOTHING to do
>with having virtual/mapped memory or not.
I think that this need not be complicated at all.
As a matter of fact, you can do it completely legally now,
without adding any functions to Exec.library.
new * realloc(old *,newsize,oldsize)
{
Forbid();
FreeMem(old,oldsize);
error=AllocAbs(newsize,old);
if(error==0) {
AllocAbs(oldsize,old); /* should not fail, I think :-) */
error=AllocMem(newsize,attributes);
if(error==0) {
Permit();
return(0);
}
Permit();
CopyMemQuick(bla bla);
FreeMem(old,oldsize);
return(error);
}
Permit();
return(old);
}
I have *NOT* tested this, and have only just now thought of it.
It should should work though.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In Real Life: Joe Porkka
porkka@frith.egr.msu
jap@syssun.cl.msu.edu (35.8.1.1)
Technical Details
Message-ID:
<2347@cps3xx.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!eecae!cps3xx!usenetReferences:
<6406@cbmvax.UUCP> <DEVEN.89Mar30052014@daniel.pawl.rpi.edu> <6464@cbmvax.UUCP> <DEVEN.89Mar31025148@daniel.pawl.rpi.edu> <432@antares.UUCP> <DEVEN.89Apr2223029@daniel.pawl.rpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!eecae!cps3xx!usenet From: usenet@cps3xx.UUCP (Usenet file owner) Newsgroups: comp.sys.amiga.tech Subject: Re: ReallocMem Message-ID: <2347@cps3xx.UUCP> Date: 3 Apr 89 21:34:28 GMT References: <6406@cbmvax.UUCP> <DEVEN.89Mar30052014@daniel.pawl.rpi.edu> <6464@cbmvax.UUCP> <DEVEN.89Mar31025148@daniel.pawl.rpi.edu> <432@antares.UUCP> <DEVEN.89Apr2223029@daniel.pawl.rpi.edu> Reply-To: porkka@frith.UUCP (Joseph A Porkka) Organization: Michigan State University Lines: 39