Path: 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> <6464@cbmvax.UUCP> <432@antares.UUCP> Reply-To: porkka@frith.UUCP (Joseph A Porkka) Organization: Michigan State University Lines: 39 In article 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)