This was unequal replacement: in new code performed more memory access

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@951 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-05-23 20:06:51 +00:00
parent c863987e18
commit 86a8e9c2d2

View File

@ -39,7 +39,7 @@ static BYTE *mainRcsId =
*/ */
int SetJFTSize(UWORD nHandles) int SetJFTSize(UWORD nHandles)
{ {
UWORD block, maxBlock; UWORD block, maxBlock, i;
psp FAR *ppsp = MK_FP(cu_psp, 0); psp FAR *ppsp = MK_FP(cu_psp, 0);
UBYTE FAR *newtab; UBYTE FAR *newtab;
@ -56,8 +56,10 @@ int SetJFTSize(UWORD nHandles)
++block; ++block;
newtab = MK_FP(block, 0); newtab = MK_FP(block, 0);
fmemset(newtab, 0xff, nHandles); i = ppsp->ps_maxfiles;
fmemcpy(newtab, ppsp->ps_filetab, ppsp->ps_maxfiles); /* copy existing part and fill up new part by "no open file" */
fmemcpy(newtab, ppsp->ps_filetab, i);
fmemset(newtab + i, 0xff, nHandles - i);
ppsp->ps_maxfiles = nHandles; ppsp->ps_maxfiles = nHandles;
ppsp->ps_filetab = newtab; ppsp->ps_filetab = newtab;