1
0
mirror of https://github.com/fachat/xa65.git synced 2024-06-29 13:29:27 +00:00

apply rest of pull request #8

This commit is contained in:
A. Fachat 2024-06-11 21:47:32 +02:00
parent b5cda1bd88
commit 485a7ec1a5

View File

@ -644,7 +644,7 @@ static int pp_replace_part(char *to, char *t, int n, int sl, int recursive,
#endif
}
/* if(flag) printf("sl=%d,",sl);*/
sl = (int) ((long) y + 1L - (long) t);
sl = (int) (y + 1 - t);
/* if(flag) printf("sl=%d\n",sl);*/
rs = fto;
#ifdef DEBUG_RECMAC
@ -665,21 +665,8 @@ static int pp_replace_part(char *to, char *t, int n, int sl, int recursive,
return (E_NOMEM);
}
/*
if(d<0)
{
y=t+sl+d;
x=t+sl;
while(*y++=*x++);
}
if(d>0)
{
for(ll=strlen(t);ll>=sl;ll--)
t[ll+d]=t[ll];
}
*/
if (d) {
// d can be positive or negative, so strcpy cannot be used, use memmove instead
// d can be positive or negative, so strcpy cannot be used, using memmove instead
(void) memmove(t + sl + d, t + sl, strlen(t) - sl + 1);
}