From 485a7ec1a5173b5e35a3aa0404dfbb284449f492 Mon Sep 17 00:00:00 2001 From: "A. Fachat" Date: Tue, 11 Jun 2024 21:47:32 +0200 Subject: [PATCH] apply rest of pull request #8 --- xa/src/xap.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/xa/src/xap.c b/xa/src/xap.c index 29a7621..1324011 100644 --- a/xa/src/xap.c +++ b/xa/src/xap.c @@ -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); }