diff --git a/src/acconfig.h b/src/acconfig.h index 75107869d8934714cb2373bfbd770393ae2f1d76..12f6bd9fa8a2ac38a498446308d6dbf4863d2cd6 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -312,9 +312,6 @@ /* Define if you have memmem. */ #undef HAVE_MEMMEM -/* Define if you have memset. */ -#undef HAVE_MEMSET - /* Define if you have memcpy. */ #undef HAVE_MEMCPY diff --git a/src/array.c b/src/array.c index 64103d7e394030924ac5b22dceebbae3f8e8c538..2f32e37ab3cd0ad103cd2aa5014350e4f90361ce 100644 --- a/src/array.c +++ b/src/array.c @@ -183,7 +183,7 @@ PMOD_EXPORT void clear_array(struct array *a) if (!a->size) return; free_svalues(ITEM(a), a->size, a->type_field); /* NB: We know that INT_T == 0. */ - MEMSET(ITEM(a), 0, a->size * sizeof(struct svalue)); + memset(ITEM(a), 0, a->size * sizeof(struct svalue)); a->type_field = BIT_INT; } diff --git a/src/backend.cmod b/src/backend.cmod index 0dd22dbee8c6962393aa218034806d055b8b63bc..84e339f7e1864b20928d1a892dcf807bb3c53723 100644 --- a/src/backend.cmod +++ b/src/backend.cmod @@ -244,7 +244,7 @@ static void low_set_backend_for_fd(int fd, struct Backend_struct *b) "Tried to allocate %"PRINTSIZET"d bytes.\n", sizeof(struct Backend_struct *) * fd_map_size); - MEMSET(fd_map+old,0,sizeof(struct Backend_struct *) * (fd_map_size-old)); + memset(fd_map+old,0,sizeof(struct Backend_struct *) * (fd_map_size-old)); } fd_map[fd]=b; } @@ -746,7 +746,7 @@ PIKECLASS Backend sizeof(struct Backend_CallOut_struct *)*me->call_heap_size*2); if(!new_heap) Pike_error("Not enough memory for another call_out\n"); - MEMSET(new_heap + me->call_heap_size, 0, + memset(new_heap + me->call_heap_size, 0, sizeof(struct Backend_CallOut_struct *)*me->call_heap_size); me->call_heap_size *= 2; me->call_heap = new_heap; @@ -1540,7 +1540,7 @@ PIKECLASS Backend me->fd_boxes_size); 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); + memset (me->fd_boxes, 0, sizeof (me->fd_boxes[0]) * shift); debug_malloc_touch(me->fd_boxes); fd -= me->fd_boxes_start; } @@ -1557,7 +1557,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); - MEMSET(me->fd_boxes+old_size, + memset(me->fd_boxes+old_size, 0, (me->fd_boxes_size-old_size)*sizeof(me->fd_boxes[0])); debug_malloc_touch(me->fd_boxes); @@ -2787,7 +2787,7 @@ int POLL_DEVICE_SET_EVENTS(struct Backend_struct *UNUSED(me), if (events) { struct epoll_event ev; #ifdef __CHECKER__ - MEMSET(&ev, 0, sizeof(ev)); + memset(&ev, 0, sizeof(ev)); #endif ev.events = events; ev.data.fd = fd; diff --git a/src/block_alloc.h b/src/block_alloc.h index 5a8edbf1b72cd49c2a3dd2a20cf6df71ef229cf6..16a52d19414019bee57f793c1ced142a791f0280 100644 --- a/src/block_alloc.h +++ b/src/block_alloc.h @@ -218,7 +218,7 @@ static void PIKE_CONCAT3(low_init_,DATA,_hash)(size_t size) \ fprintf(stderr,"Fatal: out of memory.\n"); \ exit(17); \ } \ - MEMSET(PIKE_CONCAT(DATA,_hash_table),0, \ + memset(PIKE_CONCAT(DATA,_hash_table),0, \ sizeof(struct DATA *)*PIKE_CONCAT(DATA,_hash_table_size)); \ } \ \ @@ -277,7 +277,7 @@ static void PIKE_CONCAT(DATA,_rehash)(void) \ malloc(PIKE_CONCAT(DATA,_hash_table_size)* \ sizeof(struct DATA *)))) \ { \ - MEMSET(PIKE_CONCAT(DATA,_hash_table),0, \ + memset(PIKE_CONCAT(DATA,_hash_table),0, \ sizeof(struct DATA *)*PIKE_CONCAT(DATA,_hash_table_size)); \ while(e-- > 0) \ { \ diff --git a/src/builtin.cmod b/src/builtin.cmod index 96b8a65ebdc09a43017ea1eb94ef4d8a5585064e..ce2f682498bc527994ad7cc0c704924760446cd2 100644 --- a/src/builtin.cmod +++ b/src/builtin.cmod @@ -3285,7 +3285,7 @@ PIKECLASS Buffer str->str.known_shift = shift; if (s->len < pos) // Clear the padding - MEMSET(s->str + (s->len << s->size_shift), + memset(s->str + (s->len << s->size_shift), 0, (pos - s->len) << s->size_shift); for(j = 1; j<args; j++) { @@ -3487,7 +3487,7 @@ PIKECLASS Buffer INIT { struct Buffer_struct *str = THIS; - MEMSET( str, 0, sizeof( *str ) ); + memset( str, 0, sizeof( *str ) ); } EXIT @@ -3674,7 +3674,7 @@ PIKECLASS multi_string_replace INIT { - MEMSET(&THIS->ctx, 0, sizeof(struct replace_many_context)); + memset(&THIS->ctx, 0, sizeof(struct replace_many_context)); } EXIT diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 3eafef2aec8168ff11e3371b653ba047568eb46c..e80141525cce231a462359b9c90eea2b71be89c2 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -1696,12 +1696,12 @@ PMOD_EXPORT void f_string_to_unicode(INT32 args) len = in->len * 2; out = begin_shared_string(len); if (len) { - MEMSET(out->str, 0, len); /* Clear the upper (and lower) byte */ + memset(out->str, 0, len); /* Clear the upper (and lower) byte */ #ifdef PIKE_DEBUG if (d_flag) { for(i = len; i--;) { if (out->str[i]) { - Pike_fatal("MEMSET didn't clear byte %ld of %ld\n", + Pike_fatal("memset didn't clear byte %ld of %ld\n", PTRDIFF_T_TO_LONG(i+1), PTRDIFF_T_TO_LONG(len)); } @@ -4178,8 +4178,8 @@ void compile_replace_many(struct replace_many_context *ctx, fsort((char *)ctx->v, num, sizeof(struct replace_many_tupel), (fsortfun)replace_sortfun); - MEMSET(ctx->set_start, 0, sizeof(ctx->set_start)); - MEMSET(ctx->set_end, 0, sizeof(ctx->set_end)); + memset(ctx->set_start, 0, sizeof(ctx->set_start)); + memset(ctx->set_end, 0, sizeof(ctx->set_end)); ctx->other_start = num; for(e=0;e<num;e++) @@ -5931,7 +5931,7 @@ PMOD_EXPORT void f_mktime (INT32 args) if(args == 1) { - MEMSET(&date, 0, sizeof(date)); + memset(&date, 0, sizeof(date)); push_text("sec"); push_text("min"); @@ -5953,7 +5953,7 @@ PMOD_EXPORT void f_mktime (INT32 args) get_all_args("mktime",args, "%i%i%i%i%i%i.%i%i", &sec, &min, &hour, &mday, &mon, &year, &isdst, &tz); - MEMSET(&date, 0, sizeof(date)); + memset(&date, 0, sizeof(date)); date.tm_sec=sec; date.tm_min=min; date.tm_hour=hour; @@ -6389,7 +6389,7 @@ static void f_interleave_array(INT32 args) if (!(tab = malloc(size + max))) { SIMPLE_OUT_OF_MEMORY_ERROR("interleave_array", size+max); } - MEMSET(tab, 0, size + max); + memset(tab, 0, size + max); for (i = 0; i < order->size; i++) { int low = ITEM(min)[i].u.integer; @@ -6441,7 +6441,7 @@ static void f_interleave_array(INT32 args) Pike_error("Couldn't extend table!\n"); } tab = newtab; - MEMSET(tab + size + max, 0, size); + memset(tab + size + max, 0, size); size = size * 2; } } diff --git a/src/code/ia32.c b/src/code/ia32.c index b2a654834e8c5bd6f899adc7c68956d68f89afdd..f86f43a2d167de375a3eb2ba4df63368d985f09f 100644 --- a/src/code/ia32.c +++ b/src/code/ia32.c @@ -621,7 +621,7 @@ static void ia32_local_lvalue(INT32 arg) struct svalue tmp[2]; enum ia32_reg addr_reg = ia32_get_local_addr(arg); - MEMSET(tmp, 0, sizeof(tmp)); + memset(tmp, 0, sizeof(tmp)); SET_SVAL_TYPE(tmp[0], T_SVALUE_PTR); SET_SVAL_TYPE(tmp[1], T_VOID); diff --git a/src/compilation.h b/src/compilation.h index 6dd841e5a51e045856bf87f9d616eb09ac0a787c..658102bbbb1dad674b08003e83052deeca5ca943 100644 --- a/src/compilation.h +++ b/src/compilation.h @@ -61,11 +61,11 @@ #ifdef PUSH #define IMEMBER(X,Y,Z) (nEw->Y=Pike_compiler->Y); #define STACKMEMBER(X,Y,Z) (nEw->Y=Pike_compiler->Y); -#define ZMEMBER(X,Y,Z) /* Zapped by the MEMSET in SNAME() below. */; +#define ZMEMBER(X,Y,Z) /* Zapped by the memset in SNAME() below. */; #define SNAME(X,Y) { \ struct X *nEw; \ nEw=ALLOC_STRUCT(X); \ - MEMSET((char *)nEw, 0, sizeof(struct X)); \ + memset((char *)nEw, 0, sizeof(struct X)); \ nEw->previous=Pike_compiler; #define SEND \ Pike_compiler=nEw; \ @@ -100,9 +100,9 @@ #ifdef INIT #define IMEMBER(X,Y,Z) (c->Y=Pike_compiler->Y); #define STACKMEMBER(X,Y,Z) (c->Y=Pike_compiler->Y); -#define ZMEMBER(X,Y,Z) /* Zapped by the MEMSET in SNAME() below. */; +#define ZMEMBER(X,Y,Z) /* Zapped by the memset in SNAME() below. */; #define SNAME(X,Y) { \ - MEMSET(c, 0, sizeof(struct X)); \ + memset(c, 0, sizeof(struct X)); \ c->previous = Pike_compiler; #define SEND \ Pike_compiler = c; \ diff --git a/src/configure.in b/src/configure.in index cee201869f195e4c37596d58ec8aa2120cc663ec..94ee813d354e58b5eaef271283ba4d8df5296afc 100644 --- a/src/configure.in +++ b/src/configure.in @@ -5858,126 +5858,6 @@ char foo[23]; ######################################################################## -MY_CHECK_FUNCTION(memset, -[ -#ifdef HAVE_STDDEF_H -#include <stddef.h> -#endif /* HAVE_STDDEF_H */ -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif /* HAVE_SYS_TYPES_H */ -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif /* HAVE_STDLIB_H */ -#include <stdio.h> -#include <string.h> -char foo[23]; - -struct pike_string { - int refs; - int size_shift; - ptrdiff_t len; - size_t hval; - struct pike_string *next; - char str[1]; -}; - -struct pike_string *begin_shared_string(int len) -{ - return (struct pike_string *)malloc(sizeof(struct pike_string) + len); -} - -], [ - int i; - struct pike_string *str; - ptrdiff_t len; - - memset(foo, 0, 11); - memset(foo, 'a', 10); - memset(foo, 'b', 5); - fprintf(stderr, "1\n"); - if(strcmp(foo,"bbbbbaaaaa")) { - exit(1); - } - memset(foo, 0, 6); - fprintf(stderr, "2\n"); - for (i=6; i--;) { - if (foo[i]) { - exit(1); - } - } - memset(foo+1, 1, 6); - fprintf(stderr, "3\n"); - for (i=6; i--;) { - if (foo[i+1] != 1) { - exit(1); - } - } - memset(foo+2, 0, 6); - fprintf(stderr, "4\n"); - for (i=6; i--;) { - if (foo[i+2]) { - exit(1); - } - } - memset(foo+3, 1, 6); - fprintf(stderr, "5\n"); - for (i=6; i--;) { - if (foo[i+3] != 1) { - exit(1); - } - } - memset(foo+4, 0, 6); - fprintf(stderr, "6\n"); - for (i=6; i--;) { - if (foo[i+4]) { - exit(1); - } - } - memset(foo+5, 1, 6); - fprintf(stderr, "7\n"); - for (i=6; i--;) { - if (foo[i+5] != 1) { - exit(1); - } - } - memset(foo+6, 0, 6); - fprintf(stderr, "8\n"); - for (i=6; i--;) { - if (foo[i+6]) { - exit(1); - } - } - memset(foo+7, 1, 6); - fprintf(stderr, "9\n"); - for (i=6; i--;) { - if (foo[i+7] != 1) { - exit(1); - } - } - - len = 6; - str = begin_shared_string(len); - - fprintf(stderr, "string start\n"); - if (!str) exit(1); - - for (i=len; i--;) { - str->str[i] = ~0; - } - memset(str->str, 0, len); - fprintf(stderr, "string end\n"); - for (i = len; i--;) { - if (str->str[i]) { - exit(1); - } - } - free(str); - exit(0); -]) - -######################################################################## - MY_CHECK_FUNCTION(memmove, [ #include <string.h> diff --git a/src/encode.c b/src/encode.c index 2b1d313df4fb0036dfb96f9054d18df7b7ca2044..e4d8b0d7ea833c6f13306b86766e94e14919b172 100644 --- a/src/encode.c +++ b/src/encode.c @@ -1201,7 +1201,7 @@ static void encode_value2(struct svalue *val, struct encode_data *data, int forc struct svalue str_sval; char *id_dumped = alloca(p->num_identifiers); int d_min = 0; - MEMSET(id_dumped,0,p->num_identifiers); + memset(id_dumped,0,p->num_identifiers); SET_SVAL(str_sval, T_STRING, 0, string, NULL); EDB(2, @@ -4650,7 +4650,7 @@ void f_decode_value(INT32 args) if (TYPEOF(Pike_sp[1-args]) == T_OBJECT) { if (SUBTYPEOF(Pike_sp[1-args])) { struct decode_data data; - MEMSET (&data, 0, sizeof (data)); + memset (&data, 0, sizeof (data)); data.data_str = s; /* Not refcounted. */ decode_error(&data, NULL, "The codec may not be a subtyped object yet.\n"); @@ -4680,7 +4680,7 @@ void f_decode_value(INT32 args) ptrdiff_t l=s->len; struct decode_data data; ONERROR uwp; - MEMSET (&data, 0, sizeof (data)); + memset (&data, 0, sizeof (data)); data.data_str = s; /* Not refcounted. */ SET_ONERROR (uwp, restore_current_decode, current_decode); current_decode = &data; diff --git a/src/error.c b/src/error.c index c939993f9133e09cf6df6f3c75ff217962e81abb..6fe796fea8841bceb619e51270441bb73e329934 100644 --- a/src/error.c +++ b/src/error.c @@ -519,7 +519,7 @@ PMOD_EXPORT DECLSPEC(noreturn) void debug_va_fatal(const char *fmt, va_list args #ifdef PIKE_THREADS threads_disabled++; #endif - MEMSET (&evaluator_callbacks, 0, sizeof (evaluator_callbacks)); + memset (&evaluator_callbacks, 0, sizeof (evaluator_callbacks)); if (SETJMP (jmp)) fprintf(stderr,"Got exception when trying to describe backtrace.\n"); else { diff --git a/src/fd_control.c b/src/fd_control.c index 569f9c4b80c96e9652dd34eb0b3c71fdc00c6e06..90ac7acee555444d89d7401b4b3c2d824bb4b87f 100644 --- a/src/fd_control.c +++ b/src/fd_control.c @@ -156,7 +156,7 @@ static void grow_fds_to_close(void) if(!fds_to_close) Pike_fatal("Out of memory in fd_control::grow_fds_to_close()\n" "Tried to allocate %d fd_datum structs\n", fds_to_close_size); - MEMSET( fds_to_close+(fds_to_close_size/2), 0, fds_to_close_size*sizeof(int)/2 ); + memset( fds_to_close+(fds_to_close_size/2), 0, fds_to_close_size*sizeof(int)/2 ); } void do_close_on_exec(void) diff --git a/src/fdlib.c b/src/fdlib.c index f56fe004ac83b13af768efabbd1102a18e1df066..44c8c0f4df89bc277f31109d3af4f130b5257446 100644 --- a/src/fdlib.c +++ b/src/fdlib.c @@ -1241,7 +1241,7 @@ PMOD_EXPORT int debug_fd_flock(FD fd, int oper) }else{ DWORD flags = 0; OVERLAPPED tmp; - MEMSET(&tmp, 0, sizeof(tmp)); + memset(&tmp, 0, sizeof(tmp)); tmp.Offset=0; tmp.OffsetHigh=0; @@ -1285,7 +1285,7 @@ PMOD_EXPORT int debug_fd_fstat(FD fd, PIKE_STAT_T *s) return -1; } - MEMSET(s, 0, sizeof(PIKE_STAT_T)); + memset(s, 0, sizeof(PIKE_STAT_T)); s->st_nlink=1; switch(fd_type[fd]) diff --git a/src/fdlib.h b/src/fdlib.h index 07f4275434ce71a5cf16a2d2e18fb21e9350b517..bffc25b2e897657d08ba3092879918eda2aa3f0c 100644 --- a/src/fdlib.h +++ b/src/fdlib.h @@ -215,7 +215,7 @@ typedef struct my_fd_set_s my_fd_set; #define my_FD_CLR(FD,S) ((S)->bits[(FD)>>3]&=~ (1<<(FD&7))) #define my_FD_SET(FD,S) do{ fd_check_fd(FD); ((S)->bits[(FD)>>3]|= (1<<(FD&7))); }while(0) #define my_FD_ISSET(FD,S) ((S)->bits[(FD)>>3]&(1<<(FD&7))) -#define my_FD_ZERO(S) MEMSET(& (S)->bits, 0, sizeof(my_fd_set)) +#define my_FD_ZERO(S) memset(& (S)->bits, 0, sizeof(my_fd_set)) #define fd_copy_my_fd_set_to_fd_set(TO,FROM,max) do { \ int e_,d_,max_=MINIMUM(MAX_OPEN_FILEDESCRIPTORS>>3,(max+7)>>3); \ diff --git a/src/las.c b/src/las.c index d8d14f7b5ef2400f10917667889e6b1104c750c0..8602c50ed8512ee0e9b0d4a3c15f77a91e7950e8 100644 --- a/src/las.c +++ b/src/las.c @@ -679,7 +679,7 @@ static node *debug_mkemptynode(void) CHECK_COMPILER(); #ifdef __CHECKER__ - MEMSET(res, 0, sizeof(node)); + memset(res, 0, sizeof(node)); #endif /* __CHECKER__ */ res->refs = 0; @@ -2514,7 +2514,7 @@ char *find_q(struct scope_info **a, int num, int scope_id) } #endif /* PIKE_DEBUG */ new = (struct scope_info *)xalloc(sizeof(struct scope_info)); - MEMSET(new, VAR_UNUSED, sizeof(struct scope_info)); + memset(new, VAR_UNUSED, sizeof(struct scope_info)); new->next = *a; new->scope_id = scope_id; *a = new; @@ -4044,7 +4044,7 @@ static void find_usage(node *n, unsigned char *usage, unsigned char switch_usage[MAX_LOCAL]; int i; - MEMSET(switch_usage, 0, MAX_LOCAL); + memset(switch_usage, 0, MAX_LOCAL); MEMCPY(break_usage, usage, MAX_LOCAL); find_usage(CDR(n), usage, switch_usage, cont_u, break_usage, catch_u); @@ -4058,7 +4058,7 @@ static void find_usage(node *n, unsigned char *usage, } case F_RETURN: - MEMSET(usage, 0, MAX_LOCAL); + memset(usage, 0, MAX_LOCAL); /* FIXME: The function arguments should be marked "used", since * they are seen in backtraces. */ @@ -4131,7 +4131,7 @@ static void find_usage(node *n, unsigned char *usage, * if (a) { do { c; b; } while(a); } */ - MEMSET(loop_usage, 0, MAX_LOCAL); + memset(loop_usage, 0, MAX_LOCAL); find_usage(CAR(n), loop_usage, switch_u, cont_u, break_u, catch_u); if (CDR(n)) { @@ -4163,7 +4163,7 @@ static void find_usage(node *n, unsigned char *usage, /* Find the usage from the loop */ - MEMSET(loop_usage, 0, MAX_LOCAL); + memset(loop_usage, 0, MAX_LOCAL); MEMCPY(continue_usage, usage, MAX_LOCAL); @@ -4357,7 +4357,7 @@ static node *low_localopt(node *n, unsigned char switch_usage[MAX_LOCAL]; int i; - MEMSET(switch_usage, 0, MAX_LOCAL); + memset(switch_usage, 0, MAX_LOCAL); MEMCPY(break_usage, usage, MAX_LOCAL); cdr = low_localopt(CDR(n), usage, switch_usage, cont_u, break_usage, @@ -4372,7 +4372,7 @@ static node *low_localopt(node *n, } case F_RETURN: - MEMSET(usage, 0, MAX_LOCAL); + memset(usage, 0, MAX_LOCAL); /* FIXME: The function arguments should be marked "used", since * they are seen in backtraces. */ @@ -4479,7 +4479,7 @@ static node *low_localopt(node *n, /* Find the usage from the loop. */ - MEMSET(loop_usage, 0, MAX_LOCAL); + memset(loop_usage, 0, MAX_LOCAL); find_usage(CAR(n), loop_usage, switch_u, cont_u, break_u, catch_u); if (CDR(n)) { @@ -4553,7 +4553,7 @@ static node *low_localopt(node *n, */ /* Find the usage from the loop */ - MEMSET(loop_usage, 0, MAX_LOCAL); + memset(loop_usage, 0, MAX_LOCAL); MEMCPY(continue_usage, usage, MAX_LOCAL); @@ -4627,11 +4627,11 @@ static node *localopt(node *n) unsigned char catch_usage[MAX_LOCAL]; node *n2; - MEMSET(usage, 0, MAX_LOCAL); - MEMSET(b_usage, 0, MAX_LOCAL); - MEMSET(c_usage, 0, MAX_LOCAL); - MEMSET(s_usage, 0, MAX_LOCAL); - MEMSET(catch_usage, 0, MAX_LOCAL); + memset(usage, 0, MAX_LOCAL); + memset(b_usage, 0, MAX_LOCAL); + memset(c_usage, 0, MAX_LOCAL); + memset(s_usage, 0, MAX_LOCAL); + memset(catch_usage, 0, MAX_LOCAL); n2 = low_localopt(n, usage, s_usage, c_usage, b_usage, catch_usage); diff --git a/src/lexer.h b/src/lexer.h index d0cda53791846c2375a24da72c05b28592d18a23..29bb107dfc2393ab67faedcf53754694e0b000c9 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -459,7 +459,7 @@ static int low_yylex(struct lex *lex, YYSTYPE *yylval) char *buf; #ifdef __CHECKER__ - MEMSET(yylval,0,sizeof(YYSTYPE)); + memset(yylval,0,sizeof(YYSTYPE)); #endif #ifdef MALLOC_DEBUG check_sfltable(); diff --git a/src/modules/CommonLog/clf.c b/src/modules/CommonLog/clf.c index e535ba9af4e1301cb83e4e2761f4c5dd8c00aeaa..7066f622e8d26ee6f3251e7e11ccba828cc4a3fb 100644 --- a/src/modules/CommonLog/clf.c +++ b/src/modules/CommonLog/clf.c @@ -60,7 +60,7 @@ PIKE_MODULE_INIT { int i; - MEMSET(char_class, CLS_TOKEN, sizeof(char_class)); + memset(char_class, CLS_TOKEN, sizeof(char_class)); for(i='\0'; i<=' '; i++) char_class[i] = CLS_WSPACE; for(i='0'; i<='9'; i++) diff --git a/src/modules/Gz/zlibmod.c b/src/modules/Gz/zlibmod.c index 072b83b583eebce81673e1931a22eb6181f71295..a88543de890775d4be36a254097ff06037557a5d 100644 --- a/src/modules/Gz/zlibmod.c +++ b/src/modules/Gz/zlibmod.c @@ -360,7 +360,7 @@ void zlibmod_pack(struct pike_string *data, dynamic_buffer *buf, if( wbits<0 ? (wbits<-15 || wbits>-8) : (wbits<8 || wbits>15 ) ) Pike_error("Invalid window size value %d for pack.\n", wbits); - MEMSET(&z, 0, sizeof(z)); + memset(&z, 0, sizeof(z)); z.gz.zalloc = Z_NULL; z.gz.zfree = Z_NULL; @@ -601,7 +601,7 @@ static void gz_deflate(INT32 args) static void init_gz_deflate(struct object *UNUSED(o)) { mt_init(& THIS->lock); - MEMSET(& THIS->gz, 0, sizeof(THIS->gz)); + memset(& THIS->gz, 0, sizeof(THIS->gz)); THIS->gz.zalloc=Z_NULL; THIS->gz.zfree=Z_NULL; THIS->gz.opaque=(void *)THIS; @@ -830,7 +830,7 @@ void zlibmod_unpack(struct pike_string *data, dynamic_buffer *buf, int raw) struct zipper z; int ret; - MEMSET(&z, 0, sizeof(z)); + memset(&z, 0, sizeof(z)); z.gz.zalloc = Z_NULL; z.gz.zfree = Z_NULL; @@ -1024,7 +1024,7 @@ static void gz_end_of_stream(INT32 args) static void init_gz_inflate(struct object *UNUSED(o)) { mt_init(& THIS->lock); - MEMSET(& THIS->gz, 0, sizeof(THIS->gz)); + memset(& THIS->gz, 0, sizeof(THIS->gz)); THIS->gz.zalloc=Z_NULL; THIS->gz.zfree=Z_NULL; THIS->gz.opaque=(void *)THIS; @@ -1135,7 +1135,7 @@ PIKE_MODULE_INIT add_integer_constant("FILTERED", Z_FILTERED,0); add_integer_constant("HUFFMAN_ONLY", Z_HUFFMAN_ONLY,0); - MEMSET(&z, 0, sizeof(z)); + memset(&z, 0, sizeof(z)); #ifdef Z_RLE if (deflateInit2(&z, 8, Z_DEFLATED, 9, 9, Z_RLE) == Z_OK) { have_rle = 1; diff --git a/src/modules/HTTPLoop/accept_and_parse.c b/src/modules/HTTPLoop/accept_and_parse.c index 15d76ea3af62a43de78ee7dd4efea824052a3132..6cd66a43b5ad5edd81260a3400039bb358cb97b8 100644 --- a/src/modules/HTTPLoop/accept_and_parse.c +++ b/src/modules/HTTPLoop/accept_and_parse.c @@ -530,7 +530,7 @@ static void finished_p(struct callback *UNUSED(foo), void *UNUSED(b), void *UNUS o = clone_object( request_program, 0 ); /* see requestobject.c */ obj = (struct c_request_object *)get_storage(o, c_request_program ); - MEMSET(obj, 0, sizeof(struct c_request_object)); + memset(obj, 0, sizeof(struct c_request_object)); obj->request = arg; obj->done_headers = allocate_mapping( 20 ); obj->misc_variables = allocate_mapping( 40 ); @@ -581,7 +581,7 @@ static void f_accept_with_http_parse(INT32 nargs) struct args *args = LTHIS; get_all_args("accept_http_loop", nargs, "%o%*%*%*%i%i%i", &port, &program, &fun, &cb, &ms, &dolog, &to); - MEMSET(args, 0, sizeof(struct args)); + memset(args, 0, sizeof(struct args)); if(dolog) { struct log *log = calloc(1, sizeof(struct log)); diff --git a/src/modules/HTTPLoop/log.c b/src/modules/HTTPLoop/log.c index 25496d158f1e025af144c0b2dd84b2f2cbf931fc..d92f81fc073b57a2046d7087b0474c112249dac4 100644 --- a/src/modules/HTTPLoop/log.c +++ b/src/modules/HTTPLoop/log.c @@ -169,7 +169,7 @@ void f_aap_log_as_commonlog_to_file(INT32 args) l->log_head = l->log_tail = 0; mt_unlock( &l->log_lock ); - MEMSET(&tm, 0, sizeof(tm)); + memset(&tm, 0, sizeof(tm)); while(le) { diff --git a/src/modules/HTTPLoop/requestobject.c b/src/modules/HTTPLoop/requestobject.c index cf3067c47cdf82692b59d0cf15c0b13f8aef7dcf..3393d91c7517b2abd90141244fc2956d4940ae12 100644 --- a/src/modules/HTTPLoop/requestobject.c +++ b/src/modules/HTTPLoop/requestobject.c @@ -923,7 +923,7 @@ void f_aap_reply_with_cache(INT32 args) } } ce = new_cache_entry(); - MEMSET(ce, 0, sizeof(struct cache_entry)); + memset(ce, 0, sizeof(struct cache_entry)); ce->stale_at = t+time_to_keep; ce->data = reply; @@ -953,7 +953,7 @@ void f_low_aap_reqo__init(struct c_request_object *o) void aap_init_request_object(struct object *UNUSED(o)) { - MEMSET(THIS, 0, sizeof(*THIS)); + memset(THIS, 0, sizeof(*THIS)); } void aap_exit_request_object(struct object *UNUSED(o)) diff --git a/src/modules/Image/blit.c b/src/modules/Image/blit.c index 20d5bb94f16ec510512df5cb6a3c860c2c283066..a472361aa66822901d5fcbeb26b49dff54a45b72 100644 --- a/src/modules/Image/blit.c +++ b/src/modules/Image/blit.c @@ -120,7 +120,7 @@ void img_clear(rgb_group *dest, rgb_group rgb, ptrdiff_t size) if(!size) return; THREADS_ALLOW(); if( ( rgb.r == rgb.g && rgb.r == rgb.b ) ) - MEMSET(dest, rgb.r, size*sizeof(rgb_group) ); + memset(dest, rgb.r, size*sizeof(rgb_group) ); else if(size) { int increment = 1; diff --git a/src/modules/Image/encodings/_xpm.c b/src/modules/Image/encodings/_xpm.c index 399f424d3f97e869d4d696ccbad762b96ad2f307..ca9cd6df070ed9b266af4de6b8b19e346ed2f65a 100644 --- a/src/modules/Image/encodings/_xpm.c +++ b/src/modules/Image/encodings/_xpm.c @@ -335,7 +335,7 @@ void f__xpm_write_rows( INT32 args ) if(ind > 127) { p_colors[id] = realloc(p_colors[id],sizeof(rgba_group)*256); - MEMSET(p_colors[id]+128, 0, sizeof(rgba_group)*128); + memset(p_colors[id]+128, 0, sizeof(rgba_group)*128); } p_colors[id][ind]=parse_color_line( c, bpc ); } diff --git a/src/modules/Image/encodings/avs.c b/src/modules/Image/encodings/avs.c index bdd169c1d1d22d89c8dc672410b0635208269d50..a5981b8abc3c212ef78a23e50df6ae6512193cbd 100644 --- a/src/modules/Image/encodings/avs.c +++ b/src/modules/Image/encodings/avs.c @@ -130,7 +130,7 @@ void image_avs_f_encode(INT32 args ) } s = begin_shared_string( i->xsize*i->ysize*4+8 ); - MEMSET(s->str, 0, s->len ); + memset(s->str, 0, s->len ); q = (unsigned int *)s->str; *(q++) = htonl( i->xsize ); diff --git a/src/modules/Image/encodings/bmp.c b/src/modules/Image/encodings/bmp.c index a9501315a333ebc78a42cfbc114a86fd4aba8b28..0d49ee835fdca8328e881eb01c5b929cf5f71f87 100644 --- a/src/modules/Image/encodings/bmp.c +++ b/src/modules/Image/encodings/bmp.c @@ -311,7 +311,7 @@ void img_bmp_encode(INT32 args) { /* FIXME: What if we don't have a nct? */ ps=begin_shared_string((1<<bpp)*4); - MEMSET(ps->str,0,(1<<bpp)*4); + memset(ps->str,0,(1<<bpp)*4); image_colortable_write_bgrz(nct,(unsigned char *)ps->str); push_string(end_shared_string(ps)); n++; @@ -468,7 +468,7 @@ void img_bmp_encode(INT32 args) if (!l--) { #ifdef USE_VALGRIND - MEMSET(c, 0, skip); + memset(c, 0, skip); #endif c+=skip; l=img->xsize-1; diff --git a/src/modules/Image/encodings/hrz.c b/src/modules/Image/encodings/hrz.c index ca90081d48eb0419e973cc4431996e68bedaee5f..acdf70a9c4f2877420283455703b69e47be016b8 100644 --- a/src/modules/Image/encodings/hrz.c +++ b/src/modules/Image/encodings/hrz.c @@ -87,7 +87,7 @@ void image_hrz_f_encode(INT32 args ) s = begin_shared_string( 256*240*3 ); - MEMSET(s->str, 0, s->len ); + memset(s->str, 0, s->len ); for(y=0; y<240; y++) if(y < i->ysize) for(x=0; x<256; x++) diff --git a/src/modules/Image/encodings/pcx.c b/src/modules/Image/encodings/pcx.c index 4eacb92c3fef6e023da3b7c4b2c58aaaa40e8077..dc3035ee42a447ac6ae3be0fe3e7c7f683be7606 100644 --- a/src/modules/Image/encodings/pcx.c +++ b/src/modules/Image/encodings/pcx.c @@ -112,7 +112,7 @@ void get_rle_decoded_from_data( unsigned char *dest, struct buffer * source, if(c) MEMCPY( dest, c, nelems ); else - MEMSET( dest, 0, nelems ); + memset( dest, 0, nelems ); return; } @@ -504,7 +504,7 @@ static struct pike_string *encode_pcx_8( struct pcx_header *pcx_header, { char data[256*3+1]; - MEMSET(data, 0x0c, 256*3+1); + memset(data, 0x0c, 256*3+1); image_colortable_write_rgb(opts->colortable, (unsigned char *)data+1); push_string(make_shared_binary_string(data,256*3+1)); } @@ -530,8 +530,8 @@ static struct pike_string *low_pcx_encode(struct image *data,struct options *opt pcx_header.version = 5; pcx_header.reserved = 0; pcx_header.bpp = 8; - MEMSET(pcx_header.palette, 0, 48); - MEMSET(pcx_header.filler, 0, 58); + memset(pcx_header.palette, 0, 48); + memset(pcx_header.filler, 0, 58); pcx_header.color = 1; #if PIKE_BYTEORDER == 1234 pcx_header.hdpi = SWAP_S(pcx_header.hdpi); @@ -584,7 +584,7 @@ void image_pcx_encode( INT32 args ) img = get_storage( i, image_program ); - MEMSET(&c, 0, sizeof(c)); + memset(&c, 0, sizeof(c)); c.hdpi = 150; c.vdpi = 150; c.raw = 0; diff --git a/src/modules/Image/encodings/png.c b/src/modules/Image/encodings/png.c index b708ecd4b639ca6a469f9bd88f07e024d9d13b7c..3326ff411517398ed39ad01db249fb2bda0f73ca 100644 --- a/src/modules/Image/encodings/png.c +++ b/src/modules/Image/encodings/png.c @@ -1673,7 +1673,7 @@ static void image_png_encode(INT32 args) { struct pike_string *ps; ps=begin_shared_string(3<<bpp); - MEMSET(ps->str,0,3<<bpp); + memset(ps->str,0,3<<bpp); image_colortable_write_rgb(ct,(unsigned char*)ps->str); push_string(end_shared_string(ps)); push_png_chunk("PLTE",NULL); diff --git a/src/modules/Image/encodings/psd.c b/src/modules/Image/encodings/psd.c index c62a5fa646b49d9ad58447e26f267a01b11aa9fc..8dd920b5a4e6d64548ccf825f33b6bac779e5ec0 100644 --- a/src/modules/Image/encodings/psd.c +++ b/src/modules/Image/encodings/psd.c @@ -499,7 +499,7 @@ static struct psd_image low_psd_decode( struct buffer *b ) int *s = (int *)b->str; struct psd_image i; ONERROR err; - MEMSET(&i, 0, sizeof(i)); + memset(&i, 0, sizeof(i)); SET_ONERROR( err, free_image, &i ); i.num_channels = psd_read_ushort( b ); i.rows = psd_read_uint( b ); diff --git a/src/modules/Image/encodings/tga.c b/src/modules/Image/encodings/tga.c index a86a16f29e34675360a4b9e9f6fa9e4d70618ef1..3a87adb8d6d7919f1e44df0dd61a3cb9d7a51f42 100644 --- a/src/modules/Image/encodings/tga.c +++ b/src/modules/Image/encodings/tga.c @@ -314,7 +314,7 @@ static ptrdiff_t rle_fread (guchar *buf, size_t datasize, size_t nelems, /* Optimized case for single-byte encoded data. */ if (datasize == 1) - MEMSET (p + 1, *p, bytes - 1); + memset (p + 1, *p, bytes - 1); else for (k = datasize; k < bytes; k += datasize) MEMCPY (p + k, p, datasize); @@ -583,7 +583,7 @@ static struct image_alpha ReadImage(struct buffer *fp, struct tga_header *hdr) read_so_far += pels; npels -= pels; if(npels) - MEMSET( data+(read_so_far*bypp), 0, npels*bypp ); + memset( data+(read_so_far*bypp), 0, npels*bypp ); /* Now convert the data to two image objects. */ { diff --git a/src/modules/Image/encodings/wbf.c b/src/modules/Image/encodings/wbf.c index 69792c330aab86dd4638d6f60d305cae136ac218..af8d53f3a4e7a33007e3b8e326b0614ed34bc692 100644 --- a/src/modules/Image/encodings/wbf.c +++ b/src/modules/Image/encodings/wbf.c @@ -126,7 +126,7 @@ static struct wbf_header decode_header( struct buffer *data ) { struct wbf_header res; ONERROR err; - MEMSET( &res, 0, sizeof(res) ); + memset( &res, 0, sizeof(res) ); res.type = wbf_read_int( data ); res.fix_header_field = read_uchar( data ); SET_ONERROR(err, free_wbf_header_contents, &res); diff --git a/src/modules/Image/encodings/x.c b/src/modules/Image/encodings/x.c index 20aee9a4d344d0357f54211290a463bd2d47c74d..bb425b9d7ae9508dffc1e965b94428f23fb198fa 100644 --- a/src/modules/Image/encodings/x.c +++ b/src/modules/Image/encodings/x.c @@ -257,7 +257,7 @@ static void image_x_encode_truecolor(INT32 args) } else { - MEMSET(d,0,( ( (img->xsize*bpp+alignbits-1) / alignbits ) + memset(d,0,( ( (img->xsize*bpp+alignbits-1) / alignbits ) * alignbits*img->ysize +7 ) / 8); while (y--) { diff --git a/src/modules/Image/encodings/xcf.c b/src/modules/Image/encodings/xcf.c index 4511442f85cfb72c83ec3ad2b4bf7e7b7aee7e5b..d47f92f076e1a556744fd73c59f6334c15a4c8a7 100644 --- a/src/modules/Image/encodings/xcf.c +++ b/src/modules/Image/encodings/xcf.c @@ -513,7 +513,7 @@ static struct level read_level( struct buffer *buff, int offset; struct tile *last_tile = NULL; /* int all_tiles_eq = 0; */ - MEMSET(&res, 0, sizeof(res)); + memset(&res, 0, sizeof(res)); res.width = read_uint( buff ); res.height = read_uint( buff ); @@ -545,7 +545,7 @@ static struct hierarchy read_hierarchy( struct buffer *buff, unsigned int offset; struct buffer ob; - MEMSET(&res, 0, sizeof(res)); + memset(&res, 0, sizeof(res)); res.width = read_uint( buff ); res.height = read_uint( buff ); res.bpp = read_uint( buff ); @@ -564,7 +564,7 @@ static struct layer_mask read_layer_mask( struct buffer *buff, int offset; struct property tmp; - MEMSET(&res, 0, sizeof(res)); + memset(&res, 0, sizeof(res)); res.width = read_uint( buff ); res.height = read_uint( buff ); res.name = read_string( buff ); @@ -601,7 +601,7 @@ static struct channel read_channel( struct buffer *buff, int offset; struct property tmp; - MEMSET(&res, 0, sizeof(res)); + memset(&res, 0, sizeof(res)); res.width = read_uint( buff ); res.height = read_uint( buff ); res.name = read_string( buff ); @@ -638,7 +638,7 @@ static struct layer read_layer( struct buffer *buff, struct buffer *initial ) int h_offset; ONERROR err; - MEMSET(&res, 0, sizeof(res)); + memset(&res, 0, sizeof(res)); SET_ONERROR( err, free_layer, &res ); res.width = read_uint( buff ); res.height = read_uint( buff ); @@ -667,7 +667,7 @@ static struct layer read_layer( struct buffer *buff, struct buffer *initial ) struct layer_mask *m=xalloc(sizeof(struct layer_mask)); res.mask = m; read_data( &loffset, lm_offset ); - MEMSET(m, 0, sizeof( struct layer_mask )); + memset(m, 0, sizeof( struct layer_mask )); *m = read_layer_mask( &loffset, initial ); } @@ -691,7 +691,7 @@ static struct gimp_image read_image( struct buffer * data ) unsigned int offset; ONERROR err; - MEMSET(&res, 0, sizeof(res)); + memset(&res, 0, sizeof(res)); initial = *data; if(data->len < 34) Pike_error("This is not an xcf file (to little data)\n"); diff --git a/src/modules/Image/font.c b/src/modules/Image/font.c index b2f3f0fa063bc26588d0cb655837dd84e560bdb7..5be7f5171c309d7db2e43e4c1fcb0dbcacc4f19c 100644 --- a/src/modules/Image/font.c +++ b/src/modules/Image/font.c @@ -611,7 +611,7 @@ void font_write(INT32 args) img->xsize*img->ysize*sizeof(rgb_group)+1); } - MEMSET(img->img,0,img->xsize*img->ysize*sizeof(rgb_group)); + memset(img->img,0,img->xsize*img->ysize*sizeof(rgb_group)); for (j=0; j<args; j++) { diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c index 20c4571f31dfe9215b085919a2f046e5a9f43aa8..8040acaac5f52f89f413adddd1ab3494ecf94009 100644 --- a/src/modules/Image/image.c +++ b/src/modules/Image/image.c @@ -648,7 +648,7 @@ void img_read_grey(INT32 args) d=THIS->img=xalloc(sizeof(rgb_group)*n+RGB_VEC_PAD); switch (m1) { - case 0: MEMSET(d,c1,n*sizeof(rgb_group)); break; + case 0: memset(d,c1,n*sizeof(rgb_group)); break; case 1: while (n--) { d->r=d->g=d->b=*(s1++); d++; } break; default: while (n--) { d->r=d->g=d->b=*s1; s1+=m1; d++; } } @@ -3259,7 +3259,7 @@ void image_select_from(INT32 args) SIMPLE_OUT_OF_MEMORY_ERROR("select_from", sizeof(rgb_group)*THIS->xsize*THIS->ysize+RGB_VEC_PAD); } - MEMSET(img->img,0,sizeof(rgb_group)*img->xsize*img->ysize); + memset(img->img,0,sizeof(rgb_group)*img->xsize*img->ysize); if (sp[-args].u.integer>=0 && sp[-args].u.integer<img->xsize && sp[1-args].u.integer>=0 && sp[1-args].u.integer<img->ysize) @@ -4411,7 +4411,7 @@ void image_read_lsb_rgb(INT32 args) b=128; - MEMSET(d,0,(THIS->xsize*THIS->ysize*sizeof(rgb_group)+7)>>3); + memset(d,0,(THIS->xsize*THIS->ysize*sizeof(rgb_group)+7)>>3); if (s) while (n--) @@ -4490,7 +4490,7 @@ void image_read_lsb_grey(INT32 args) b=128; - MEMSET(d,0,(THIS->xsize*THIS->ysize+7)>>3); + memset(d,0,(THIS->xsize*THIS->ysize+7)>>3); if (s) while (n--) diff --git a/src/modules/Image/image_module.c b/src/modules/Image/image_module.c index 128229b38b00d053c4e2d83346d1288678b1391c..746badb051b7f2c4819bea248add129af5df2275 100644 --- a/src/modules/Image/image_module.c +++ b/src/modules/Image/image_module.c @@ -182,7 +182,7 @@ static void init_cpuidflags( ) { unsigned int a, b, c, d; char *data = alloca(20); - MEMSET( data, 0, 20 ); + memset( data, 0, 20 ); image_get_cpuid( 0, &a, &b, &c, &d ); diff --git a/src/modules/Image/matrix.c b/src/modules/Image/matrix.c index 0c2da6a2bb083dcb0b4e26c92d2728a448e36a5d..b20b68e1ee5e529c89efaf27f358e5210be3fb2c 100644 --- a/src/modules/Image/matrix.c +++ b/src/modules/Image/matrix.c @@ -247,7 +247,7 @@ void img_scale2(struct image *dest, struct image *source) new=xalloc(newx*newy*sizeof(rgb_group)+RGB_VEC_PAD); THREADS_ALLOW(); - MEMSET(new,0,newx*newy*sizeof(rgb_group)); + memset(new,0,newx*newy*sizeof(rgb_group)); dest->img=new; dest->xsize=newx; diff --git a/src/modules/Oracle/oracle.c b/src/modules/Oracle/oracle.c index 819cce7145bc8d5a27fdcb8443bdbff4fa7d9cf2..6c4c021e32e6292f7d53b81cc38008125cd3496b 100644 --- a/src/modules/Oracle/oracle.c +++ b/src/modules/Oracle/oracle.c @@ -960,7 +960,7 @@ static sb4 output_callback(struct inout *inout, #endif *piecep = OCI_NEXT_PIECE; #ifdef ORACLE_DEBUG - MEMSET(*bufpp, '#', inout->xlen); + memset(*bufpp, '#', inout->xlen); ((char *)*bufpp)[inout->xlen-1]=0; #endif return OCI_CONTINUE; @@ -1170,7 +1170,7 @@ static void f_fetch_fields(INT32 args) data_size=sizeof(info->data.u.num); #ifdef ORACLE_DEBUG /* OCINumberSetZero(dbcon->error_handle, &info->data.u.num); */ - MEMSET(&info->data.u.num, 0, data_size); + memset(&info->data.u.num, 0, data_size); #endif type=SQLT_VNU; #endif @@ -1802,7 +1802,7 @@ static void f_fetch_row(INT32 args) #endif /* piece = OCI_NEXT_PIECE; */ #ifdef ORACLE_DEBUG - MEMSET(buf, '#', inout->xlen); + memset(buf, '#', inout->xlen); buf[inout->xlen-1]=0; #endif ret = OCIStmtSetPieceInfo(define, htype, dbcon->error_handle, diff --git a/src/modules/_Image_GIF/image_gif.c b/src/modules/_Image_GIF/image_gif.c index de7dfe8d0a664d82cbed7e2b46994b859b8bbb25..62cfa7c43ba172e7f026b93d71f1e475f88bfeeb 100644 --- a/src/modules/_Image_GIF/image_gif.c +++ b/src/modules/_Image_GIF/image_gif.c @@ -280,7 +280,7 @@ void image_gif_header_block(INT32 args) { ps=begin_shared_string((1<<bpp)*3); image_colortable_write_rgb(nct,(unsigned char *)ps->str); - MEMSET(ps->str + (numcolors + alphaentry) * 3, 0, + memset(ps->str + (numcolors + alphaentry) * 3, 0, ((1 << bpp) - numcolors - alphaentry) * 3); if (alphaentry) @@ -913,7 +913,7 @@ CHRONO("render_block index end"); CHRONO("gif render_block write local colortable begin"); ps=begin_shared_string((1<<bpp)*3); image_colortable_write_rgb(nct,(unsigned char *)ps->str); - MEMSET(ps->str+(numcolors+alphaentry)*3,0,((1<<bpp)-numcolors)*3); + memset(ps->str+(numcolors+alphaentry)*3,0,((1<<bpp)-numcolors)*3); if (alphaentry) { ps->str[3*alphaidx+0]=alphacolor.r; diff --git a/src/modules/_Image_TIFF/image_tiff.c b/src/modules/_Image_TIFF/image_tiff.c index ec3762ace67901c93ea45019c235fbd07ba416ee..1c5aff29e09893b598ff3aa4db3b91669c399e4e 100644 --- a/src/modules/_Image_TIFF/image_tiff.c +++ b/src/modules/_Image_TIFF/image_tiff.c @@ -106,7 +106,7 @@ static void increase_buffer_size( struct buffer * buffer ) if(!new_d) Pike_error("Realloc (%ld->%ld) failed!\n", DO_NOT_WARN((long)buffer->len), DO_NOT_WARN((long)buffer->len*2)); - MEMSET(new_d+buffer->len, 0, buffer->len); + memset(new_d+buffer->len, 0, buffer->len); buffer->str = new_d; buffer->len *= 2; } @@ -812,7 +812,7 @@ static void image_tiff__decode( INT32 args ) if(TYPEOF(sp[-args]) != T_STRING) Pike_error("Invalid argument 1 to Image.TIFF.decode()\n"); - MEMSET(&res, 0, sizeof(res)); + memset(&res, 0, sizeof(res)); buffer.str = sp[-args].u.string->str; buffer.len = buffer.real_len = sp[-args].u.string->len; buffer.extendable = 0; @@ -910,7 +910,7 @@ static void image_tiff_encode( INT32 args ) get_all_args( "encode", args, "%o", &a.img ); - MEMSET(&c, 0, sizeof(c)); + memset(&c, 0, sizeof(c)); c.xdpy = 150.0; c.ydpy = 150.0; c.compression = 0; /* Not a defined value. */ diff --git a/src/modules/_Image_TTF/image_ttf.c b/src/modules/_Image_TTF/image_ttf.c index 247d5e5f183295daf37dc1a7c92d4020283c675e..c22adfcf908c387c97c0361806eb0eb43bff3d5d 100644 --- a/src/modules/_Image_TTF/image_ttf.c +++ b/src/modules/_Image_TTF/image_ttf.c @@ -1159,7 +1159,7 @@ static void image_ttf_faceinstance_write(INT32 args) if ((res=TT_Get_Glyph_Metrics(glyph,&metrics))) { errs="TT_Get_Glyph_Metrics: "; break; } - MEMSET(pixmap,0,rastermap.size); + memset(pixmap,0,rastermap.size); if ((res=TT_Get_Glyph_Pixmap(glyph, &rastermap, diff --git a/src/modules/_Stdio/file.c b/src/modules/_Stdio/file.c index aa7e57a47cf44ed35cdb820449989d939cfd8585..41094a37a28ff13ae0c1e0ce0e79b54d089f091e 100644 --- a/src/modules/_Stdio/file.c +++ b/src/modules/_Stdio/file.c @@ -4164,7 +4164,7 @@ int my_socketpair(int family, int type, int protocol, int sv[2]) */ ACCEPT_SIZE_T len; - MEMSET(&addr,0,sizeof(struct sockaddr_in)); + memset(&addr,0,sizeof(struct sockaddr_in)); /* We lie, we actually create an AF_INET socket... */ if(family != AF_UNIX || type != SOCK_STREAM) @@ -4196,7 +4196,7 @@ int my_socketpair(int family, int type, int protocol, int sv[2]) * Let's hope those few people who don't have socketpair have * a loopback on 127.0.0.1 */ - MEMSET(&my_addr,0,sizeof(struct sockaddr_in)); + memset(&my_addr,0,sizeof(struct sockaddr_in)); my_addr.sin_family=AF_INET; my_addr.sin_addr.s_addr=htonl(INADDR_ANY); my_addr.sin_port=htons(0); diff --git a/src/modules/_Stdio/sendfile.c b/src/modules/_Stdio/sendfile.c index a7c0550d84d79daf9b659dc63d29dddef300ce90..2e1c32b172b487a8dbe961ce16cb36883eaa4788 100644 --- a/src/modules/_Stdio/sendfile.c +++ b/src/modules/_Stdio/sendfile.c @@ -159,7 +159,7 @@ static struct program *pike_sendfile_prog = NULL; static void init_pike_sendfile(struct object *UNUSED(o)) { - MEMSET(THIS, 0, sizeof(struct pike_sendfile)); + memset(THIS, 0, sizeof(struct pike_sendfile)); /* callback doesn't actually need to be initialized since it is a * mapped variable, but since we just zapped it with zeroes we need @@ -892,7 +892,7 @@ static void sf_create(INT32 args) * This means that we can throw errors without needing to clean up. */ - MEMSET(&sf, 0, sizeof(struct pike_sendfile)); + memset(&sf, 0, sizeof(struct pike_sendfile)); SET_SVAL(sf.callback, T_INT, NUMBER_NUMBER, integer, 0); get_all_args("sendfile", args, "%A%O%l%l%A%o%*", diff --git a/src/modules/_Stdio/stat.c b/src/modules/_Stdio/stat.c index 0f5fa12bea6b69dfb45dcde32bd46fabbe9f3c99..c19315e53ca2943cde00958400fbd846bb09d97f 100644 --- a/src/modules/_Stdio/stat.c +++ b/src/modules/_Stdio/stat.c @@ -306,7 +306,7 @@ static void stat_push_compat(INT_TYPE n) static void stat_init (struct object *UNUSED(o)) { - MEMSET (&THIS_STAT->s, 0, sizeof (THIS_STAT->s)); + memset (&THIS_STAT->s, 0, sizeof (THIS_STAT->s)); } /*! @decl void create (void|object|array stat); diff --git a/src/modules/_Stdio/udp.c b/src/modules/_Stdio/udp.c index 20fb9e035dd4b0e8a896f8a5a10ab2e1f7eb8f4f..89d73400ff7de7c59f4475b5546af3549c0c54f2 100644 --- a/src/modules/_Stdio/udp.c +++ b/src/modules/_Stdio/udp.c @@ -529,7 +529,7 @@ void udp_add_membership(INT32 args) /* NB: This sets imr_interface to IN6ADDR_ANY, * and clears imr_ifindex if it exists. */ - MEMSET(&sock, 0, sizeof(sock)); + memset(&sock, 0, sizeof(sock)); if(SOCKADDR_FAMILY(addr) != AF_INET6) Pike_error("Mixing IPv6 and other multicast is not supported.\n"); @@ -546,7 +546,7 @@ void udp_add_membership(INT32 args) /* NB: This sets imr_interface to INADDR_ANY, * and clears imr_ifindex if it exists. */ - MEMSET(&sock, 0, sizeof(sock)); + memset(&sock, 0, sizeof(sock)); if(SOCKADDR_FAMILY(addr) != AF_INET) Pike_error("Mixing IPv6 and IPv4 multicast is not supported.\n"); @@ -615,7 +615,7 @@ void udp_drop_membership(INT32 args) /* NB: This sets imr_interface to IN6ADDR_ANY, * and clears imr_ifindex if it exists. */ - MEMSET(&sock, 0, sizeof(sock)); + memset(&sock, 0, sizeof(sock)); if(SOCKADDR_FAMILY(addr) != AF_INET6) Pike_error("Mixing IPv6 and other multicast is not supported.\n"); @@ -632,7 +632,7 @@ void udp_drop_membership(INT32 args) /* NB: This sets imr_interface to INADDR_ANY, * and clears imr_ifindex if it exists. */ - MEMSET(&sock, 0, sizeof(sock)); + memset(&sock, 0, sizeof(sock)); if(SOCKADDR_FAMILY(addr) != AF_INET) Pike_error("Mixing IPv6 and IPv4 multicast is not supported.\n"); diff --git a/src/modules/_WhiteFish/blob.c b/src/modules/_WhiteFish/blob.c index ad6b07ef64a43a991d82c487526f2805e7b37d30..43dd6747aecc6d8efee142b978e6887498dfff48 100644 --- a/src/modules/_WhiteFish/blob.c +++ b/src/modules/_WhiteFish/blob.c @@ -560,7 +560,7 @@ static void f_blob__cast( INT32 args ) static void init_blob_struct(struct object * UNUSED(o)) { - MEMSET( THIS, 0, sizeof( struct blob_data ) ); + memset( THIS, 0, sizeof( struct blob_data ) ); } static void exit_blob_struct(struct object * o) diff --git a/src/modules/_WhiteFish/blobs.c b/src/modules/_WhiteFish/blobs.c index 847a0c9c301c6d1405268917dd7ba151dd9b3796..7ec9d8432c74269e6b39918f10daa7bc7f2311dd 100644 --- a/src/modules/_WhiteFish/blobs.c +++ b/src/modules/_WhiteFish/blobs.c @@ -234,7 +234,7 @@ static void f_blobs_read_all_sorted( INT32 UNUSED(args) ) static void init_blobs_struct(struct object *UNUSED(o)) { - MEMSET( THIS, 0, sizeof( struct blobs ) ); + memset( THIS, 0, sizeof( struct blobs ) ); THIS->size = sizeof( struct blobs ) + 128; } diff --git a/src/modules/_WhiteFish/buffer.c b/src/modules/_WhiteFish/buffer.c index ecf6cda8a94ad59b6391d265a954cab10e1ee9b3..9e93987023b16f2a3a53dad060cefaae954b136d 100644 --- a/src/modules/_WhiteFish/buffer.c +++ b/src/modules/_WhiteFish/buffer.c @@ -150,7 +150,7 @@ void wf_buffer_seek_w( struct buffer *b, unsigned int pos ) if( pos > b->size ) { wf_buffer_make_space( b, (unsigned int)(pos-b->size) ); - MEMSET( b->data+b->size, 0, (unsigned int)(pos-b->size) ); + memset( b->data+b->size, 0, (unsigned int)(pos-b->size) ); } b->size = pos; } @@ -160,7 +160,7 @@ void wf_buffer_clear( struct buffer *b ) if( !b->read_only && b->data ) free( b->data ); if( b->read_only && b->str ) free_string( b->str ); - MEMSET(b, 0, sizeof(struct buffer)); + memset(b, 0, sizeof(struct buffer)); } void wf_buffer_free( struct buffer *b ) diff --git a/src/modules/_WhiteFish/linkfarm.c b/src/modules/_WhiteFish/linkfarm.c index 6110cd624ad9a155a536c7c2eb3a0e4203f19cf2..f7c2f38a3b5f7262c9c7cd6e344263acad4e8d5c 100644 --- a/src/modules/_WhiteFish/linkfarm.c +++ b/src/modules/_WhiteFish/linkfarm.c @@ -200,7 +200,7 @@ static void f_linkfarm_read( INT32 args ) static void init_linkfarm_struct(struct object * UNUSED(o)) { - MEMSET( THIS, 0, sizeof( struct linkfarm ) ); + memset( THIS, 0, sizeof( struct linkfarm ) ); } static void exit_linkfarm_struct(struct object *o) diff --git a/src/modules/_WhiteFish/whitefish.c b/src/modules/_WhiteFish/whitefish.c index a808522fc31473d0b9525c2c24a59ff5526ffb39..3951c49952e5083df182f1a2d37aa78111fb7bb5 100644 --- a/src/modules/_WhiteFish/whitefish.c +++ b/src/modules/_WhiteFish/whitefish.c @@ -74,7 +74,7 @@ static void handle_hit( Blob **blobs, int matrix[65][8]; - MEMSET(matrix, 0, sizeof(matrix) ); + memset(matrix, 0, sizeof(matrix) ); for( i = 0; i<nblobs; i++ ) nhits[i] = wf_blob_nhits( blobs[i] ); @@ -82,7 +82,7 @@ static void handle_hit( Blob **blobs, for( i = 0; i<nblobs; i++ ) { - MEMSET( pos, 0, nblobs ); + memset( pos, 0, nblobs ); for( j = 0; j<nhits[i]; j++ ) { hits[i] = wf_blob_hit( blobs[i], j ); @@ -201,7 +201,7 @@ static void handle_phrase_hit( Blob **blobs, int matrix[65]; double accum = 0.0; - MEMSET(matrix, 0, sizeof(matrix) ); + memset(matrix, 0, sizeof(matrix) ); for( i = 0; i<nblobs; i++ ) diff --git a/src/modules/system/memory.c b/src/modules/system/memory.c index 60a207179c0340dbea4271aee8e6d8fd8dd95bc8..603d5946d3188b96ab9f8ab9a08ca851c3a80f90 100644 --- a/src/modules/system/memory.c +++ b/src/modules/system/memory.c @@ -465,13 +465,13 @@ static void memory_allocate(INT32 args) { THREADS_ALLOW(); mem = xalloc(size); - MEMSET(mem,c,size); + memset(mem,c,size); THREADS_DISALLOW(); } else { mem = xalloc(size); - MEMSET(mem,c,size); + memset(mem,c,size); } MEMORY_FREE(THIS); diff --git a/src/modules/system/system.c b/src/modules/system/system.c index 34ed4586565fe062c7cd485940c4068760761b6c..d8350b94fe65be57e117f437ae55a5faf8884c8c 100644 --- a/src/modules/system/system.c +++ b/src/modules/system/system.c @@ -1843,7 +1843,7 @@ int my_isipv6nr(char *s) #define CALL_GETHOSTBYNAME(X) \ THREADS_ALLOW(); \ - MEMSET(&data,0,sizeof(data)); \ + memset(&data,0,sizeof(data)); \ if(gethostbyname_r((X), &result, &data) < 0) { \ ret=0; \ }else{ \ @@ -1853,7 +1853,7 @@ int my_isipv6nr(char *s) #define CALL_GETHOSTBYADDR(X,Y,Z) \ THREADS_ALLOW(); \ - MEMSET(&data,0,sizeof(data)); \ + memset(&data,0,sizeof(data)); \ if(gethostbyaddr_r((X),(Y),(Z), &result, &data) < 0) { \ ret=0; \ }else{ \ @@ -1886,7 +1886,7 @@ int my_isipv6nr(char *s) #define CALL_GETSERVBYNAME(X,Y) \ THREADS_ALLOW(); \ - MEMSET(&data,0,sizeof(data)); \ + memset(&data,0,sizeof(data)); \ if(getservbyname_r((X), (Y), &result, &data) < 0) { \ ret=0; \ }else{ \ @@ -1925,7 +1925,7 @@ int get_inet_addr(PIKE_SOCKADDR *addr,char *name,char *service, INT_TYPE port, int err; int udp = inet_flags & 1; - MEMSET(addr,0,sizeof(PIKE_SOCKADDR)); + memset(addr,0,sizeof(PIKE_SOCKADDR)); if(name && !strcmp(name,"*")) name = NULL; @@ -1999,7 +1999,7 @@ int get_inet_addr(PIKE_SOCKADDR *addr,char *name,char *service, INT_TYPE port, if (inet_flags & 2) { SOCKADDR_FAMILY(*addr) = AF_INET6; /* Note: This is equvivalent to :: (aka IPv6 ANY). */ - MEMSET(&addr->ipv6.sin6_addr, 0, sizeof(addr->ipv6.sin6_addr)); + memset(&addr->ipv6.sin6_addr, 0, sizeof(addr->ipv6.sin6_addr)); } #endif diff --git a/src/pike_memory.c b/src/pike_memory.c index 0655702950fedec7b40df3ae8bbb4481a7811219..9a6ff483e26094f743d112aa383800f12e0d5c36 100644 --- a/src/pike_memory.c +++ b/src/pike_memory.c @@ -1332,7 +1332,7 @@ void *calloc(size_t x, size_t y) LOWDEBUG3("calloc x",x); LOWDEBUG3("calloc y",y); ret=malloc(x*y); - if(ret) MEMSET(ret,0,x*y); + if(ret) memset(ret,0,x*y); #ifndef REPORT_ENCAPSULATED_MALLOC dmalloc_accept_leak(ret); #endif @@ -1344,7 +1344,7 @@ void *fake_calloc(size_t x, size_t y) { void *ret; ret=fake_malloc(x*y); - if(ret) MEMSET(ret,0,x*y); + if(ret) memset(ret,0,x*y); #ifndef REPORT_ENCAPSULATED_MALLOC dmalloc_accept_leak(ret); #endif @@ -2164,7 +2164,7 @@ PMOD_EXPORT void *debug_calloc(size_t a, size_t b, LOCATION location) { void *m=debug_malloc(a*b,location); if(m) - MEMSET(m, 0, a*b); + memset(m, 0, a*b); if(verbose_debug_malloc) fprintf(stderr, "calloc(%ld, %ld) => %p (%s)\n", @@ -2237,7 +2237,7 @@ PMOD_EXPORT void debug_free(void *p, LOCATION location, int mustfind) if (PIKE_MEM_CHECKER()) PIKE_MEM_NA_RANGE(p, mh->size); else - MEMSET(p, 0x55, mh->size); + memset(p, 0x55, mh->size); if(mh->size < MAX_UNFREE_MEM/FREE_DELAY) { add_location(mh, location); @@ -2834,7 +2834,7 @@ static void initialize_dmalloc(void) th_key_create(&dmalloc_last_seen_location, 0); #endif init_memhdr_hash(); - MEMSET(mlhash, 0, sizeof(mlhash)); + memset(mlhash, 0, sizeof(mlhash)); for(e=0;e<(long)NELEM(rndbuf);e++) rndbuf[e]= (rand() % 511) | 1; diff --git a/src/port.c b/src/port.c index 3f0d3666abd77eb7bcfcd3c88a8bee91fd52318c..8ca91133265a2b1b9338e0df68e7e37e5dbcb653 100644 --- a/src/port.c +++ b/src/port.c @@ -262,15 +262,6 @@ PMOD_EXPORT int STRCASECMP(const char *a,const char *b) } #endif -#ifndef HAVE_MEMSET -void *MEMSET(void *s,int c,size_t n) -{ - char *t; - for(t=s;n;n--) *(t++)=c; - return s; -} -#endif - #if !defined(HAVE_MEMCPY) && !defined(HAVE_BCOPY) PMOD_EXPORT void MEMCPY(void *bb,const void *aa,size_t s) { diff --git a/src/port.h b/src/port.h index 8142f0486805df421b90f97005e16e180e616420..ab317065321759f368f8a20999fbcf971c8a84dd 100644 --- a/src/port.h +++ b/src/port.h @@ -170,11 +170,8 @@ PMOD_EXPORT int STRCASECMP(const char *a,const char *b); #define HAVE_STRNCMP 1 #define STRNCMP strncmp -#ifndef HAVE_MEMSET -void *MEMSET (void *s,int c,size_t n); -#else -# define MEMSET memset -#endif +#define HAVE_MEMSET 1 +#define MEMSET memset #ifndef HAVE_MEMCPY # ifdef HAVE_BCOPY diff --git a/src/post_modules/GTK1/source/gdkwindow.pre b/src/post_modules/GTK1/source/gdkwindow.pre index 5d782d4366c1f2a3ac79bc8c36608b14c8e9e43c..f977968f6da2aa43c41d9c63975f73e79fa0bac6 100644 --- a/src/post_modules/GTK1/source/gdkwindow.pre +++ b/src/post_modules/GTK1/source/gdkwindow.pre @@ -28,7 +28,7 @@ void create(GDK1.Window|int parent, mapping|void attributes) struct mapping *m; GdkWindowAttr attrs; long mask = 0; - MEMSET(&attrs, 0, sizeof(attrs)); + memset(&attrs, 0, sizeof(attrs)); get_all_args( "create", args, "%o%m", &parent, &m ); #define GET_ARG(x,y,z) pgtk_get_mapping_arg( m, #x, y, z, &attrs.x, &mask, sizeof(attrs.x)) diff --git a/src/post_modules/GTK1/source/gtkwidget.pre b/src/post_modules/GTK1/source/gtkwidget.pre index f778a5729a35b6803ef737cd8cc0275490ed705f..591517d74e2e171d9f91ec2aa4da3038023c0e37 100644 --- a/src/post_modules/GTK1/source/gtkwidget.pre +++ b/src/post_modules/GTK1/source/gtkwidget.pre @@ -513,8 +513,8 @@ void set_cursor(?int cursor_type, ?GDK1.Color fg, ?GDK1.Color bg) if( c && fg && bg ) { XColor fgp, bgp; - MEMSET(&fgp, 0, sizeof(fg) ); - MEMSET(&bgp, 0, sizeof(bg) ); + memset(&fgp, 0, sizeof(fg) ); + memset(&bgp, 0, sizeof(bg) ); if( get_gdkobject( fg, color ) ) fgp.pixel = ((GdkColor *)get_gdkobject( fg, color ))->pixel; diff --git a/src/post_modules/GTK1/source/support.c b/src/post_modules/GTK1/source/support.c index 916641f992e6cab27d7b431aa2336c7237ee5ae5..649fec129677a8274a7f480c00a86425040cf410 100644 --- a/src/post_modules/GTK1/source/support.c +++ b/src/post_modules/GTK1/source/support.c @@ -163,7 +163,7 @@ GdkImage *gdkimage_from_pikeimage( struct object *img, int fast, GdkImage *i ) int j, i, r, g, b; PFTIME("Creating colormap"); colors_allocated=1; - MEMSET(allocated, 0, sizeof(allocated)); + memset(allocated, 0, sizeof(allocated)); for(r=0; r<3; r++) for(g=0; g<4; g++) for(b=0; b<3; b++) { GdkColor color; @@ -834,7 +834,7 @@ void pgtk_default__sprintf( int args, int offset, int len ) void pgtk_clear_obj_struct(struct object *o) { - MEMSET(Pike_fp->current_storage, 0, sizeof(struct object_wrapper)); + memset(Pike_fp->current_storage, 0, sizeof(struct object_wrapper)); } diff --git a/src/post_modules/GTK2/source/gdkwindow.pre b/src/post_modules/GTK2/source/gdkwindow.pre index d9a22cff765ef85fe77d2c3f9836af9376fb9fc5..853077172998fa65ed51ccac2a9a44b672d1b761 100644 --- a/src/post_modules/GTK2/source/gdkwindow.pre +++ b/src/post_modules/GTK2/source/gdkwindow.pre @@ -33,7 +33,7 @@ void create(GDK2.Window|int parent, mapping|void attributes) GdkWindowAttr attrs; GdkWindow *w; long mask=0; - MEMSET(&attrs,0,sizeof(attrs)); + memset(&attrs,0,sizeof(attrs)); get_all_args("create",args,"%o%m",&parent,&m); #define GET_ARG(x,y,z) pgtk2_get_mapping_arg( m, #x, y, z, &attrs.x, &mask, sizeof(attrs.x)) diff --git a/src/post_modules/GTK2/source/support.c b/src/post_modules/GTK2/source/support.c index 56e71f0dabb4d81ec93ae5ffc812bda334bc5a3f..6400a9ca45dd2df6f8f7372c058851a565d53633 100644 --- a/src/post_modules/GTK2/source/support.c +++ b/src/post_modules/GTK2/source/support.c @@ -162,7 +162,7 @@ GdkImage *gdkimage_from_pikeimage(struct object *img, int fast, GObject **pi) { int j,i,r,g,b; PFTIME("Creating colormap"); colors_allocated=1; - MEMSET(allocated,0,sizeof(allocated)); + memset(allocated,0,sizeof(allocated)); for (r=0; r<3; r++) for (g=0; g<4; g++) for (b=0; b<3; b++) { GdkColor color; color.red = (guint16)(r * (65535/2.0)); @@ -846,7 +846,7 @@ void pgtk2_default__sprintf(int args, int offset, int len) { } void pgtk2_clear_obj_struct(struct object *o) { - MEMSET(Pike_fp->current_storage,0,sizeof(struct object_wrapper)); + memset(Pike_fp->current_storage,0,sizeof(struct object_wrapper)); } void pgtk2_setup_mixin(struct object *o, struct program *p) { diff --git a/src/post_modules/Nettle/cipher.cmod b/src/post_modules/Nettle/cipher.cmod index 04566e645e912b613f31f204c921471bce0d2f9e..9f2dd72bfbdefacfb0cf2e0a18f84ad737c2b929 100644 --- a/src/post_modules/Nettle/cipher.cmod +++ b/src/post_modules/Nettle/cipher.cmod @@ -1210,7 +1210,7 @@ PIKECLASS BlockCipher THIS->block_size = block_size; THIS->iv = begin_shared_string(block_size); - MEMSET(STR0(THIS->iv), 0, block_size); + memset(STR0(THIS->iv), 0, block_size); THIS->iv->flags |= STRING_CLEAR_ON_EXIT; if (THIS->object) free_object(THIS->object); @@ -1740,7 +1740,7 @@ PIKECLASS BlockCipher } THIS->iv = begin_shared_string(block_size); - MEMSET(STR0(THIS->iv), 0, block_size); + memset(STR0(THIS->iv), 0, block_size); THIS->iv->flags |= STRING_CLEAR_ON_EXIT; THIS->block_size = block_size; @@ -2254,7 +2254,7 @@ PIKECLASS BlockCipher } THIS->iv = begin_shared_string(block_size); - MEMSET(STR0(THIS->iv), 0, block_size); + memset(STR0(THIS->iv), 0, block_size); THIS->iv->flags |= STRING_CLEAR_ON_EXIT; THIS->block_size = block_size; @@ -2646,7 +2646,7 @@ PIKECLASS BlockCipher } THIS->iv = begin_shared_string(block_size); - MEMSET(STR0(THIS->iv), 0, block_size); + memset(STR0(THIS->iv), 0, block_size); THIS->iv->flags |= STRING_CLEAR_ON_EXIT; THIS->block_size = block_size; @@ -3178,7 +3178,7 @@ PIKECLASS BlockCipher16 *(ctr_iv++) = 14 - iv_len; MEMCPY(ctr_iv, STR0(iv), iv_len); - MEMSET(ctr_iv + iv_len, 0, 15 - iv_len); + memset(ctr_iv + iv_len, 0, 15 - iv_len); RETURN this_object(); } @@ -5760,10 +5760,10 @@ void cipher_init(void) { nul13_string = begin_shared_string(13); - MEMSET(STR0(nul13_string), 0, 13); + memset(STR0(nul13_string), 0, 13); nul13_string = end_shared_string(nul13_string); nul16_string = begin_shared_string(16); - MEMSET(STR0(nul16_string), 0, 16); + memset(STR0(nul16_string), 0, 16); nul16_string = end_shared_string(nul16_string); INIT; diff --git a/src/post_modules/Nettle/hash.cmod b/src/post_modules/Nettle/hash.cmod index d700bfe7b397064e466ef77ca3e8fe3f8ed02012..403c09a888a5a2b7c19a6af3a415704d29585c80 100644 --- a/src/post_modules/Nettle/hash.cmod +++ b/src/post_modules/Nettle/hash.cmod @@ -437,8 +437,8 @@ PIKECLASS Hash push_string(end_shared_string(res)); /* 22e */ /* Clean intermediate values. */ - MEMSET(ctx, 0, meta->context_size); - MEMSET(abcbuf, 0, 3*dsz); + memset(ctx, 0, meta->context_size); + memset(abcbuf, 0, 3*dsz); } INIT diff --git a/src/program.c b/src/program.c index ac6741bc0c6be6524a29599fb11e974d044c4fea..69fb9c86a4291b02ae15a99eec802b13e24cb518 100644 --- a/src/program.c +++ b/src/program.c @@ -2860,7 +2860,7 @@ void fixate_program(void) struct program *low_allocate_program(void) { struct program *p=alloc_program(); - MEMSET(p, 0, sizeof(struct program)); + memset(p, 0, sizeof(struct program)); p->flags|=PROGRAM_VIRGIN; p->alignment_needed=1; @@ -2966,7 +2966,7 @@ void low_start_new_program(struct program *p, Pike_compiler->fake_object->storage=(char *)malloc(256 * sizeof(struct svalue)); if (Pike_compiler->fake_object->storage) { /* Stipple to find illegal accesses */ - MEMSET(Pike_compiler->fake_object->storage,0x55,256*sizeof(struct svalue)); + memset(Pike_compiler->fake_object->storage,0x55,256*sizeof(struct svalue)); PIKE_MEM_WO_RANGE (Pike_compiler->fake_object->storage, 256 * sizeof (struct svalue)); } @@ -9315,7 +9315,7 @@ static void compilation_event_handler(int e) case PROG_EVENT_INIT: CDFPRINTF((stderr, "th(%ld) compilation: INIT(%p).\n", (long) th_self(), c)); - MEMSET(c, 0, sizeof(*c)); + memset(c, 0, sizeof(*c)); c->supporter.self = Pike_fp->current_object; /* NOTE: Not ref-counted! */ c->compilation_inherit = Pike_fp->context - Pike_fp->current_object->prog->inherits; diff --git a/src/rusage.c b/src/rusage.c index b1bee11482eef4ed5c9591e5061e74378d829e2c..c06958910f5d6199b39262b4ea377731c39c566a 100644 --- a/src/rusage.c +++ b/src/rusage.c @@ -117,7 +117,7 @@ PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values) unsigned __int64 ft_scalar; FILETIME ft_struct; } creationTime, exitTime, kernelTime, userTime; - MEMSET(rusage_values, 0, sizeof(pike_rusage_t)); + memset(rusage_values, 0, sizeof(pike_rusage_t)); if (GetProcessTimes(GetCurrentProcess(), &creationTime.ft_struct, &exitTime.ft_struct, @@ -173,7 +173,7 @@ PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values) #ifdef GETRUSAGE_THROUGH_PROCFS_PRS prstatus_t prs; #endif - MEMSET(rusage_values, 0, sizeof(pike_rusage_t)); + memset(rusage_values, 0, sizeof(pike_rusage_t)); if (proc_fd < 0 && !open_proc_fd()) return 0; while(ioctl(proc_fd, PIOCUSAGE, &pru) < 0) @@ -241,7 +241,7 @@ PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values) struct rusage rus; long utime, stime; int maxrss; - MEMSET(rusage_values, 0, sizeof(pike_rusage_t)); + memset(rusage_values, 0, sizeof(pike_rusage_t)); if (getrusage(RUSAGE_SELF, &rus) < 0) return 0; @@ -288,7 +288,7 @@ PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values) if (!pike_clk_tck) error ("Called before init_pike.\n"); #endif - MEMSET(rusage_values, 0, sizeof(pike_rusage_t)); + memset(rusage_values, 0, sizeof(pike_rusage_t)); if (ret == (clock_t) -1) return 0; rusage_values[0] = CONVERT_TIME (tms.tms_utime, pike_clk_tck, 1000); @@ -313,7 +313,7 @@ PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values) PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values) { - MEMSET(rusage_values, 0, sizeof(pike_rusage_t)); + memset(rusage_values, 0, sizeof(pike_rusage_t)); rusage_values[0]= CONVERT_TIME (clock(), CLOCKS_PER_SEC, 1000); return 1; } @@ -324,7 +324,7 @@ PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values) { /* This is totally wrong, but hey, if you can't do it _right_... */ struct timeval tm; - MEMSET(rusage_values, 0, sizeof(pike_rusage_t)); + memset(rusage_values, 0, sizeof(pike_rusage_t)); #ifndef CONFIGURE_TEST ACCURATE_GETTIMEOFDAY(&tm); #else diff --git a/src/signal_handler.c b/src/signal_handler.c index d363210d8a847dc859d39b3df67c1a25f7d375a4..c3c6d63e4e48ed9c65c13b62fd62cccc9e7949cb 100644 --- a/src/signal_handler.c +++ b/src/signal_handler.c @@ -770,7 +770,7 @@ void my_signal(int sig, sigfunctype fun) * where _funcptr is a union. ie sa_handler and * sa_sigaction overlap. */ - MEMSET(&action, 0, sizeof(action)); + memset(&action, 0, sizeof(action)); action.sa_handler = fun; sigfillset(&action.sa_mask); action.sa_flags = 0; @@ -784,7 +784,7 @@ void my_signal(int sig, sigfunctype fun) #ifdef HAVE_SIGVEC { struct sigvec action; - MEMSET(&action, 0, sizeof(action)); + memset(&action, 0, sizeof(action)); action.sv_handler= fun; action.sv_mask=-1; #ifdef SV_INTERRUPT @@ -1208,7 +1208,7 @@ static RETSIGTYPE receive_sigchild(int UNUSED(signum)) #ifdef __CHECKER__ /* Clear potential padding. */ - MEMSET(&wd, 0, sizeof(wd)); + memset(&wd, 0, sizeof(wd)); #endif PROC_FPRINTF((stderr, "[%d] receive_sigchild got pid %d\n", @@ -2383,8 +2383,8 @@ static int set_priority( int pid, char *to ) long pad2[10]; } foo; - MEMSET(¶ms, 0, sizeof(params)); - MEMSET(&foo, 0, sizeof(foo)); + memset(¶ms, 0, sizeof(params)); + memset(&foo, 0, sizeof(foo)); strcpy(foo.pc_clname, "RT"); if( priocntl((idtype_t)0, (id_t)0, PC_GETCID, (void *)(&foo)) == -1) @@ -2409,8 +2409,8 @@ static int set_priority( int pid, char *to ) long pad2[10]; } foo; - MEMSET(¶ms, 0, sizeof(params)); - MEMSET(&foo, 0, sizeof(foo)); + memset(¶ms, 0, sizeof(params)); + memset(&foo, 0, sizeof(foo)); strcpy(foo.pc_clname, "TS"); if( priocntl((idtype_t)0, (id_t)0, PC_GETCID, (void *)(&foo)) == -1) return 0; @@ -2424,14 +2424,14 @@ static int set_priority( int pid, char *to ) if( prilevel == 3 ) { struct sched_param param; - MEMSET(¶m, 0, sizeof(param)); + memset(¶m, 0, sizeof(param)); param.sched_priority = sched_get_priority_max( SCHED_FIFO ); return !sched_setscheduler( pid, SCHED_FIFO, ¶m ); } else { #ifdef SCHED_RR struct sched_param param; int class = SCHED_OTHER; - MEMSET(¶m, 0, sizeof(param)); + memset(¶m, 0, sizeof(param)); if(prilevel == 2) { class = SCHED_RR; @@ -2925,7 +2925,7 @@ void f_create_process(INT32 args) /* FIXME: Ought to set filename properly. */ - MEMSET(&info,0,sizeof(info)); + memset(&info,0,sizeof(info)); info.cb=sizeof(info); GetStartupInfo(&info); diff --git a/src/sscanf.c b/src/sscanf.c index f7ca45d12ba5d4f8ecb0c2a9b8766abc4bcb2050..e548106e09a74df88d7a412c0fb0255f79e336ae 100644 --- a/src/sscanf.c +++ b/src/sscanf.c @@ -286,7 +286,7 @@ static ptrdiff_t PIKE_CONCAT(read_set,SIZE) ( \ if(cnt>=match_len) \ Pike_error("Unterminated sscanf set.\n"); \ \ - MEMSET(set->c, 0, sizeof(set->c)); \ + memset(set->c, 0, sizeof(set->c)); \ set->a=0; \ \ if(match[cnt]=='^' && \ @@ -1048,30 +1048,30 @@ INPUT_IS_WIDE( \ \ /* sscanf("foo-bar","%s%d",a,b) might not work as expected */ \ case 'd': \ - MEMSET(set.c, 1, sizeof(set.c)); \ + memset(set.c, 1, sizeof(set.c)); \ for(e='0';e<='9';e++) set.c[e]=0; \ set.c['-']=0; \ goto match_set; \ \ case 'o': \ - MEMSET(set.c, 1, sizeof(set.c)); \ + memset(set.c, 1, sizeof(set.c)); \ for(e='0';e<='7';e++) set.c[e]=0; \ goto match_set; \ \ case 'x': \ - MEMSET(set.c, 1, sizeof(set.c)); \ + memset(set.c, 1, sizeof(set.c)); \ for(e='0';e<='9';e++) set.c[e]=0; \ for(e='a';e<='f';e++) set.c[e]=0; \ goto match_set; \ \ case 'D': \ - MEMSET(set.c, 1, sizeof(set.c)); \ + memset(set.c, 1, sizeof(set.c)); \ for(e='0';e<='9';e++) set.c[e]=0; \ set.c['-']=0; \ goto match_set; \ \ case 'f': \ - MEMSET(set.c, 1, sizeof(set.c)); \ + memset(set.c, 1, sizeof(set.c)); \ for(e='0';e<='9';e++) set.c[e]=0; \ set.c['.']=set.c['-']=0; \ goto match_set; \ diff --git a/src/stralloc.c b/src/stralloc.c index bb872c80461f3cb690a2849cbc90efde3d9dd17d..e21e188b6e6e1c75eff3e880f290d8e4af041cc0 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -2453,7 +2453,7 @@ PMOD_EXPORT void string_builder_putchars(struct string_builder *s, int ch, switch (s->s->size_shift) { case 0: - MEMSET (STR0 (s->s) + s->s->len, ch, count); + memset (STR0 (s->s) + s->s->len, ch, count); break; case 1: { int i; @@ -2608,7 +2608,7 @@ PMOD_EXPORT void string_builder_fill(struct string_builder *s, len == 1 && (!from.shift || !min_magnitude(EXTRACT_PCHARP(from)))) { - MEMSET(string_builder_allocate(s,howmany,0), + memset(string_builder_allocate(s,howmany,0), EXTRACT_PCHARP(from), howmany); /* Ensure NUL-termination */ @@ -3546,7 +3546,7 @@ PMOD_EXPORT int convert_stack_top_string_to_inumber(int base) character after the last one used in the number is put in *ENDPTR. */ PMOD_EXPORT double STRTOD_PCHARP(PCHARP nptr, PCHARP *endptr) { - /* Note: Code duplication in STRTOD. */ + /* Note: Code duplication in strtod. */ register PCHARP s; short int sign; diff --git a/src/threads.c b/src/threads.c index 3714653f9fb17a3c09b9a97771c95c5fe0f92d35..41c7c81cd939dc2bfc32957a17ee80d7bcf9ee78 100644 --- a/src/threads.c +++ b/src/threads.c @@ -2843,7 +2843,7 @@ static void f_thread_id_kill(INT32 args) void init_thread_obj(struct object *UNUSED(o)) { - MEMSET(&THIS_THREAD->state, 0, sizeof(struct Pike_interpreter_struct)); + memset(&THIS_THREAD->state, 0, sizeof(struct Pike_interpreter_struct)); THIS_THREAD->thread_obj = Pike_fp->current_object; THIS_THREAD->swapped = 0; THIS_THREAD->status=THREAD_NOT_STARTED;