diff --git a/src/acconfig.h b/src/acconfig.h index 320c04eb30caa60a8c2d66f2a748484cc4cf8624..54ba4cbd9d6400fec3a313ef2f022dd516e6e7ad 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -304,11 +304,6 @@ /* Define if you have gethostname */ #undef HAVE_GETHOSTNAME -/* Define if you have memmove. */ -#ifndef __CHECKER__ -#undef HAVE_MEMMOVE -#endif - /* Define if you have memmem. */ #undef HAVE_MEMMEM diff --git a/src/apply_low.h b/src/apply_low.h index 2fbc1c1c7bcfe4a4fd0fac724db5ab9255e5b798..43fb7cbbf6c1d3d27558094f9b2a51c498bf1f96 100644 --- a/src/apply_low.h +++ b/src/apply_low.h @@ -252,7 +252,7 @@ { /* Create an extra svalue for tail recursion style call */ Pike_sp++; - MEMMOVE(Pike_sp-args,Pike_sp-args-1,sizeof(struct svalue)*args); + memmove(Pike_sp-args,Pike_sp-args-1,sizeof(struct svalue)*args); #ifdef DEBUG_MALLOC if (args) { int i; diff --git a/src/array.c b/src/array.c index 3203568245901d48db16f8bb6b04b18465bf2851..005c46c5efa0d0b0e1c33ffef3d02037a9417ef7 100644 --- a/src/array.c +++ b/src/array.c @@ -399,12 +399,12 @@ PMOD_EXPORT struct array *array_insert(struct array *v,struct svalue *s,INT32 in if ((v->item != v->real_item) && (((index<<1) < v->size) || ((v->item + v->size) == (v->real_item + v->malloced_size)))) { - MEMMOVE((char *)(ITEM(v)-1), + memmove((char *)(ITEM(v)-1), (char *)(ITEM(v)), index * sizeof(struct svalue)); v->item--; } else { - MEMMOVE((char *)(ITEM(v)+index+1), + memmove((char *)(ITEM(v)+index+1), (char *)(ITEM(v)+index), (v->size-index) * sizeof(struct svalue)); } @@ -649,7 +649,7 @@ PMOD_EXPORT struct array *array_remove(struct array *v,INT32 index) } else { if(v->size-index>1) { - MEMMOVE((char *)(ITEM(v)+index), + memmove((char *)(ITEM(v)+index), (char *)(ITEM(v)+index+1), (v->size-index-1)*sizeof(struct svalue)); } @@ -1687,7 +1687,7 @@ PMOD_EXPORT struct array *add_arrays(struct svalue *argp, INT32 args) if (!v2 || (v->size > v2->size)) { /* Got a potential candidate. * - * Optimize for maximum MEMMOVE() + * Optimize for maximum memmove() * (ie minimum assign_svalues_no_free()). */ tmp2 = tmp; @@ -1700,7 +1700,7 @@ PMOD_EXPORT struct array *add_arrays(struct svalue *argp, INT32 args) if (v2) { debug_malloc_touch(v2); mark_free_svalue(argp + e2); - MEMMOVE((char *)(v2->real_item + tmp2), (char *)ITEM(v2), + memmove((char *)(v2->real_item + tmp2), (char *)ITEM(v2), v2->size * sizeof(struct svalue)); v2->item = v2->real_item + tmp2; for(tmp=e2-1;tmp>=0;tmp--) diff --git a/src/backend.cmod b/src/backend.cmod index 486a571846fd455f0b68f3779045f32a5d14a523..abb06ed5359032f7a0a4e75aeea8c4271b15980d 100644 --- a/src/backend.cmod +++ b/src/backend.cmod @@ -1538,7 +1538,7 @@ PIKECLASS Backend Pike_fatal ("Out of memory in backend::add_fd_box(): " "Tried to allocate %d fd_callback_box pointers\n", me->fd_boxes_size); - MEMMOVE (me->fd_boxes + shift, me->fd_boxes, + memmove (me->fd_boxes + shift, me->fd_boxes, sizeof (me->fd_boxes[0]) * old_size); memset (me->fd_boxes, 0, sizeof (me->fd_boxes[0]) * shift); debug_malloc_touch(me->fd_boxes); diff --git a/src/builtin_functions.c b/src/builtin_functions.c index a163d3f0b481ac18035d7067deb59ba4ea38ccb4..e4e66448358b504b25389d356c05d5bd49953fe3 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -9052,7 +9052,7 @@ PMOD_EXPORT void f_filter(INT32 args) pop_n_elems(args-2); } else { - MEMMOVE(Pike_sp-args+1,Pike_sp-args,args*sizeof(*Pike_sp)); + memmove(Pike_sp-args+1,Pike_sp-args,args*sizeof(*Pike_sp)); dmalloc_touch_svalue(Pike_sp); Pike_sp++; add_ref_svalue(Pike_sp-args); @@ -9090,7 +9090,7 @@ PMOD_EXPORT void f_filter(INT32 args) /* mapping ret = mkmapping(indices(arr), map(values(arr),fun,@extra)); */ - MEMMOVE(Pike_sp-args+2,Pike_sp-args,args*sizeof(*Pike_sp)); + memmove(Pike_sp-args+2,Pike_sp-args,args*sizeof(*Pike_sp)); Pike_sp+=2; mark_free_svalue (Pike_sp-args-2); mark_free_svalue (Pike_sp-args-1); diff --git a/src/configure.in b/src/configure.in index 920e990c1d83ff34758faa5d8228de0999706795..51a4efb13d3b590bf3394496983289e09af1eeb0 100644 --- a/src/configure.in +++ b/src/configure.in @@ -5843,24 +5843,6 @@ char *d="gazonk"; ######################################################################## -MY_CHECK_FUNCTION(memmove, -[ -#include <string.h> -char buf[100]; -], [ - strcpy(buf,"foo bar gazonk elefantsnabel."); - if(strcmp(buf,"foo bar gazonk elefantsnabel.")) exit(1); - memmove(buf,buf+1,7); - if(strcmp(buf,"oo bar gazonk elefantsnabel.")) exit(1); - memmove(buf+1,buf+1,9); - if(strcmp(buf,"oo bar gazonk elefantsnabel.")) exit(1); - memmove(buf+1,buf,11); - if(strcmp(buf,"ooo bar gaznk elefantsnabel.")) exit(1); - exit(0); -]) - -######################################################################## - AC_MSG_CHECKING(if we can declare environ) AC_CACHE_VAL(pike_cv_declare_environ,[ AC_TRY_COMPILE([ diff --git a/src/interpret_functions.h b/src/interpret_functions.h index bf53c9bcbc1f92e654c316ac9d9c85fc571c87f3..135030ea622e5bb7bee27d4bd5dd867160e93958 100644 --- a/src/interpret_functions.h +++ b/src/interpret_functions.h @@ -265,7 +265,7 @@ OPCODE1(F_CONSTANT, "constant", I_UPDATE_SP, { OPCODE2(F_REARRANGE,"rearrange",0,{ check_stack(arg2); memcpy(Pike_sp,Pike_sp-arg1-arg2,sizeof(struct svalue)*arg2); - MEMMOVE(Pike_sp-arg1-arg2,Pike_sp-arg1,sizeof(struct svalue)*arg1); + memmove(Pike_sp-arg1-arg2,Pike_sp-arg1,sizeof(struct svalue)*arg1); memcpy(Pike_sp-arg2,Pike_sp,sizeof(struct svalue)*arg2); }); diff --git a/src/modules/Gmp/mpq.cmod b/src/modules/Gmp/mpq.cmod index a684a078fa8ad074e5d577b7e5dbb0c188960244..98abc9ba8190cb5d0a071ba300178c9266d69284 100644 --- a/src/modules/Gmp/mpq.cmod +++ b/src/modules/Gmp/mpq.cmod @@ -373,7 +373,7 @@ PIKECLASS mpq len-=4; if (len < 1) len = 1; while(s->str[len]) len++; - MEMMOVE(s->str, s->str+1, len-prec); + memmove(s->str, s->str+1, len-prec); }else{ /* Shift the fractional part backward to make room for the dot. */ mpz_get_str(s->str, 10, num); @@ -381,7 +381,7 @@ PIKECLASS mpq len-=5; if (len < 0) len = 0; while(s->str[len]) len++; - MEMMOVE(s->str+len-prec+1, + memmove(s->str+len-prec+1, s->str+len-prec, prec+1); len++; @@ -405,7 +405,7 @@ PIKECLASS mpq for (; prec > len; prec--) *p++ = '0'; mpz_get_str (p, 10, num); if (!p[len - 1]) { - MEMMOVE (p + 1, p, len - 1); + memmove (p + 1, p, len - 1); *p = '0'; } push_string (end_and_resize_shared_string (s, p - s->str + len)); diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c index 0112f70b0e2e3e0550ad80c06dea518cd7b68a11..c408ac4777ec409046a9e3acda71d4578a5078b1 100644 --- a/src/modules/Gmp/mpz_glue.c +++ b/src/modules/Gmp/mpz_glue.c @@ -1179,7 +1179,7 @@ static void name(INT32 args) \ return; \ STRINGCONV( \ case T_STRING: \ - MEMMOVE(sp-args+1, sp-args, sizeof(struct svalue)*args); \ + memmove(sp-args+1, sp-args, sizeof(struct svalue)*args); \ sp++; args++; \ SET_SVAL_TYPE(sp[-args], PIKE_T_FREE); \ SET_SVAL(sp[-args], T_STRING, 0, string, \ @@ -1269,7 +1269,7 @@ static void mpzmod_add_eq(INT32 args) push_float( (FLOAT_TYPE)ret ); return; case T_STRING: - MEMMOVE(sp-args+1, sp-args, sizeof(struct svalue)*args); + memmove(sp-args+1, sp-args, sizeof(struct svalue)*args); sp++; args++; SET_SVAL_TYPE(sp[-args], PIKE_T_FREE); SET_SVAL(sp[-args], T_STRING, 0, string, diff --git a/src/modules/Image/colortable.c b/src/modules/Image/colortable.c index 90363d594e30d2fa7b3b66da889e57b4a4b4dedd..c24ec3dd20372e4859752890c7e123ffefd8d50d 100644 --- a/src/modules/Image/colortable.c +++ b/src/modules/Image/colortable.c @@ -611,7 +611,7 @@ static ptrdiff_t reduce_recurse(struct nct_flat_entry *src, n=reduce_recurse(src,dest,left,i,level+2,sf,newpos1,space,type); if (n!=oldn) { if (n<oldn) /* i certainly hope so */ - MEMMOVE(dest+n,dest+oldn,sizeof(struct nct_flat_entry)*m); + memmove(dest+n,dest+oldn,sizeof(struct nct_flat_entry)*m); else /* huh? */ /* this is the only case we don't have them already */ m=reduce_recurse(src+left,dest+n,src_size-left, diff --git a/src/modules/Oracle/oracle.c b/src/modules/Oracle/oracle.c index 6c4c021e32e6292f7d53b81cc38008125cd3496b..ad7be2bf9133a9dd1bdea649bc6f3d00084eb84e 100644 --- a/src/modules/Oracle/oracle.c +++ b/src/modules/Oracle/oracle.c @@ -1526,7 +1526,7 @@ static void push_inout_value(struct inout *inout, case SQLT_NUM: /* Kluge -- Convert it to a VNU. */ - MEMMOVE(inout->u.shortstr+1,inout->u.shortstr,inout->xlen); + memmove(inout->u.shortstr+1,inout->u.shortstr,inout->xlen); inout->u.shortstr[0]=inout->xlen; /* FALL_THROUGH */ diff --git a/src/modules/Parser/html.c b/src/modules/Parser/html.c index 580b1be214ecab55fda2f01f3bb6b71cc3cf9e13..3565b013ecb965ab6a45f9962a8cb2659c072d2b 100644 --- a/src/modules/Parser/html.c +++ b/src/modules/Parser/html.c @@ -1137,7 +1137,7 @@ static void html_add_quote_tag(INT32 args) pop_stack(); } free_svalues (arr->item+i, 3, BIT_MIXED); - MEMMOVE (arr->item+i, arr->item+i+3, (arr->size-i-3) * sizeof(struct svalue)); + memmove (arr->item+i, arr->item+i+3, (arr->size-i-3) * sizeof(struct svalue)); arr->size -= 3; } else { @@ -1165,7 +1165,7 @@ static void html_add_quote_tag(INT32 args) } else arr = val->u.array = resize_array (arr, arr->size+3); - MEMMOVE (arr->item+i+3, arr->item+i, + memmove (arr->item+i+3, arr->item+i, (arr->size-i-3) * sizeof(struct svalue)); memcpy (arr->item+i, sp-=3, 3 * sizeof(struct svalue)); goto done; diff --git a/src/port.c b/src/port.c index a5250583de61ebe9bb1cc612ed0191de2d73cd67..c55cde789d55dc253f70dc1e6dcebcc2acb3e022 100644 --- a/src/port.c +++ b/src/port.c @@ -262,20 +262,6 @@ PMOD_EXPORT int STRCASECMP(const char *a,const char *b) } #endif -#ifndef HAVE_MEMMOVE -PMOD_EXPORT void MEMMOVE(void *b,const void *aa,size_t s) -{ - char *t=(char *)b; - char *a=(char *)aa; - if(a>t) - for(;s;s--) *(t++)=*(a++); - else - if(a<t) - for(t+=s,a+=s;s;s--) *(--t)=*(--a); -} -#endif - - #ifndef HAVE_MEMCMP PMOD_EXPORT int MEMCMP(const void *bb,const void *aa,size_t s) { diff --git a/src/port.h b/src/port.h index e02ff7e77c24339b6bcda89dbf9e0a5883ec1d79..de6a0bbc5857e295c3d780aec4bcf63d3b8de18c 100644 --- a/src/port.h +++ b/src/port.h @@ -176,11 +176,8 @@ PMOD_EXPORT int STRCASECMP(const char *a,const char *b); #define HAVE_MEMCPY 1 #define MEMCPY(X,Y,Z) memcpy((X),(Y),(Z)) -#ifndef HAVE_MEMMOVE -PMOD_EXPORT void MEMMOVE(void *b,const void *a,size_t s); -#else -# define MEMMOVE memmove -#endif +#define HAVE_MEMMOVE 1 +#define MEMMOVE memmove #ifndef HAVE_MEMCMP PMOD_EXPORT int MEMCMP(const void *b,const void *a,size_t s); diff --git a/src/post_modules/_ADT/circular_list.cmod b/src/post_modules/_ADT/circular_list.cmod index 7c7d08536802fecb9cf22f7cb8f07115dc336bb4..acaac999e5b09501c0e3a32eba38e096b8e41e46 100644 --- a/src/post_modules/_ADT/circular_list.cmod +++ b/src/post_modules/_ADT/circular_list.cmod @@ -495,7 +495,7 @@ PIKECLASS CircularList THIS->a->size = size; if (THIS->size > 0) { - MEMMOVE((char *)(ITEM(THIS->a)+(size-endpos)), + memmove((char *)(ITEM(THIS->a)+(size-endpos)), (char *)(ITEM(THIS->a)+(THIS->pos)), (endpos) * sizeof(struct svalue)); THIS->pos = size-endpos;