From: Amos Jeffries Date: Mon, 13 Dec 2010 11:31:14 +0000 (+1300) Subject: Compat: cleanup several config.h hacks X-Git-Tag: take00~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=41d00cd39ee1d8d8ea0808b9c100069f151efa10;p=thirdparty%2Fsquid.git Compat: cleanup several config.h hacks * removes the xmemcpy and xmemmove hacks. Squid has been building for some long time without them being consistently used all-over. No complaints. bcopy() alternative is still use if needed. However main code can now use memcpy( )and memmove() without special X knowledge. * shuffle strnstr replacement into libcompat from libmisc * shuffles xis*() function wrappers for is*() with type-casting into compat No operational changes. --- diff --git a/compat/GnuRegex.c b/compat/GnuRegex.c index 86cdc2962f..3bfa598942 100644 --- a/compat/GnuRegex.c +++ b/compat/GnuRegex.c @@ -214,7 +214,7 @@ char *alloca(); /* Assumes a `char *destination' variable. */ #define REGEX_REALLOCATE(source, osize, nsize) \ (destination = (char *) alloca (nsize), \ - xmemcpy (destination, source, osize), \ + memcpy (destination, source, osize), \ destination) #endif /* not REGEX_MALLOC */ diff --git a/compat/Makefile.am b/compat/Makefile.am index 21abe287e7..671c5106d1 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -32,6 +32,7 @@ libcompat_squid_a_SOURCES = \ osdetect.h \ psignal.h \ stdvarargs.h \ + strnstr.cc \ strsep.h \ strtoll.h \ tempnam.h \ @@ -40,6 +41,7 @@ libcompat_squid_a_SOURCES = \ valgrind.h \ xalloc.cc \ xalloc.h \ + xis.h \ xstrerror.cc \ xstrerror.h \ xstring.cc \ diff --git a/compat/compat_shared.h b/compat/compat_shared.h index 6e63e635bd..3ca876b2c3 100644 --- a/compat/compat_shared.h +++ b/compat/compat_shared.h @@ -205,6 +205,41 @@ extern "C" { #include "compat/xstrerror.h" #include "compat/xstring.h" #include "compat/xstrto.h" +#include "compat/xis.h" +#if !HAVE_MEMCPY +#if HAVE_BCOPY +#define memcpy(d,s,n) bcopy((s),(d),(n)) +#elif HAVE_MEMMOVE +#define memcpy(d,s,n) memmove((d),(s),(n)) +#endif +#endif + +#if !HAVE_MEMMOVE && HAVE_BCOPY +#define memmove(d,s,n) bcopy((s),(d),(n)) +#endif + +/* + * strnstr() is needed. The OS may not provide a working copy. + */ +#if HAVE_STRNSTR +/* If strnstr exists and is usable we do so. */ +#define squid_strnstr(a,b,c) strnstr(a,b,c) +#else +/* If not we have our own copy imported from FreeBSD */ +const char * squid_strnstr(const char *s, const char *find, size_t slen); +#endif + +#if __GNUC__ +#if !defined(PRINTF_FORMAT_ARG1) +#define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2))) +#endif +#if !defined(PRINTF_FORMAT_ARG2) +#define PRINTF_FORMAT_ARG2 __attribute__ ((format (printf, 2, 3))) +#endif +#if !defined(PRINTF_FORMAT_ARG3) +#define PRINTF_FORMAT_ARG3 __attribute__ ((format (printf, 3, 4))) +#endif +#endif #endif /* _SQUID_COMPAT_SHARED_H */ diff --git a/compat/os/mswin.h b/compat/os/mswin.h index f59dd621d8..15beb902f2 100644 --- a/compat/os/mswin.h +++ b/compat/os/mswin.h @@ -749,5 +749,14 @@ struct rusage { SQUIDCEXTERN size_t getpagesize(void); #endif +/* gcc doesn't recognize the Windows native 64 bit formatting tags causing + * the compile fail, so we must disable the check on native Windows. + */ +#if __GNUC__ +#define PRINTF_FORMAT_ARG1 +#define PRINTF_FORMAT_ARG2 +#define PRINTF_FORMAT_ARG3 +#endif + #endif /* _SQUID_WIN32_ */ #endif /* SQUID_OS_MSWIN_H */ diff --git a/lib/strnstr.cc b/compat/strnstr.cc similarity index 96% rename from lib/strnstr.cc rename to compat/strnstr.cc index 4d7676fdb6..3c86e170c0 100644 --- a/lib/strnstr.cc +++ b/compat/strnstr.cc @@ -1,5 +1,6 @@ -#ifndef _SQUID_COMPAT_STRNSTR_C_ -#define _SQUID_COMPAT_STRNSTR_C_ +#ifndef _SQUID_COMPAT_STRNSTR_CC_ +#define _SQUID_COMPAT_STRNSTR_CC_ + /* * Shamelessly duplicated from the FreeBSD public sources * for use by the Squid Project under GNU Public License. @@ -17,7 +18,6 @@ */ #include "config.h" -#include "strnstr.h" #if !HAVE_STRNSTR @@ -65,7 +65,7 @@ #include #endif -/* +/** * Find the first occurrence of find in s, where the search is limited to the * first slen characters of s. */ @@ -93,4 +93,4 @@ squid_strnstr(const char *s, const char *find, size_t slen) } #endif /* !HAVE_STRNSTR */ -#endif /* _SQUID_COMPAT_STRNSTR_C_ */ +#endif /* _SQUID_COMPAT_STRNSTR_CC_ */ diff --git a/compat/xalloc.cc b/compat/xalloc.cc index c1e59773c6..a9f6cf5376 100644 --- a/compat/xalloc.cc +++ b/compat/xalloc.cc @@ -56,7 +56,7 @@ malloc_statistics(void (*func) (int, int, int, void *), void *data) for (; i <= XMS_DBG_MAXSIZE; i += XMS_DBG_GRAIN) func(i, malloc_sizes[XMS_DBG_INDEX(i)], malloc_histo[XMS_DBG_INDEX(i)], data); - xmemcpy(&malloc_histo, &malloc_sizes, sizeof(malloc_sizes)); + memcpy(&malloc_histo, &malloc_sizes, sizeof(malloc_sizes)); } #endif /* XMALLOC_STATISTICS */ diff --git a/compat/xis.h b/compat/xis.h new file mode 100644 index 0000000000..0e5eac10db --- /dev/null +++ b/compat/xis.h @@ -0,0 +1,22 @@ +#ifndef _SQUID_COMPAT_XIS_H +#define _SQUID_COMPAT_XIS_H + +#if HAVE_CTYPE_H +#include +#endif +#define xisspace(x) isspace((unsigned char)x) +#define xtoupper(x) toupper((unsigned char)x) +#define xtolower(x) tolower((unsigned char)x) +#define xisdigit(x) isdigit((unsigned char)x) +#define xisascii(x) isascii((unsigned char)x) +#define xislower(x) islower((unsigned char)x) +#define xisalpha(x) isalpha((unsigned char)x) +#define xisprint(x) isprint((unsigned char)x) +#define xisalnum(x) isalnum((unsigned char)x) +#define xiscntrl(x) iscntrl((unsigned char)x) +#define xispunct(x) ispunct((unsigned char)x) +#define xisupper(x) isupper((unsigned char)x) +#define xisxdigit(x) isxdigit((unsigned char)x) +#define xisgraph(x) isgraph((unsigned char)x) + +#endif /* _SQUID_COMPAT_XIS_H */ diff --git a/doc/Programming-Guide/02_CodingConventions.dox b/doc/Programming-Guide/02_CodingConventions.dox index bb99c8d2f8..22bccd5d52 100644 --- a/doc/Programming-Guide/02_CodingConventions.dox +++ b/doc/Programming-Guide/02_CodingConventions.dox @@ -176,7 +176,7 @@ fubar(char *g, int glen, void *state) { * then passes the state off to FUBAR. * No check for null-termination is done. */ - xmemcpy(g, glen, state->foo_end_ptr ); + memcpy(g, glen, state->foo_end_ptr ); state->foo_end_ptr += glen; fubar(state); } diff --git a/include/config.h b/include/config.h index 4ae2da08ff..34ae37b417 100644 --- a/include/config.h +++ b/include/config.h @@ -91,38 +91,6 @@ #define SQUID_UDP_SO_RCVBUF SQUID_DETECT_UDP_SO_RCVBUF #endif -#if HAVE_MEMCPY -#define xmemcpy(d,s,n) memcpy((d),(s),(n)) -#elif HAVE_BCOPY -#define xmemcpy(d,s,n) bcopy((s),(d),(n)) -#elif HAVE_MEMMOVE -#define xmemcpy(d,s,n) memmove((d),(s),(n)) -#endif - -#if HAVE_MEMMOVE -#define xmemmove(d,s,n) memmove((d),(s),(n)) -#elif HAVE_BCOPY -#define xmemmove(d,s,n) bcopy((s),(d),(n)) -#endif - -#if HAVE_CTYPE_H -#include -#endif -#define xisspace(x) isspace((unsigned char)x) -#define xtoupper(x) toupper((unsigned char)x) -#define xtolower(x) tolower((unsigned char)x) -#define xisdigit(x) isdigit((unsigned char)x) -#define xisascii(x) isascii((unsigned char)x) -#define xislower(x) islower((unsigned char)x) -#define xisalpha(x) isalpha((unsigned char)x) -#define xisprint(x) isprint((unsigned char)x) -#define xisalnum(x) isalnum((unsigned char)x) -#define xiscntrl(x) iscntrl((unsigned char)x) -#define xispunct(x) ispunct((unsigned char)x) -#define xisupper(x) isupper((unsigned char)x) -#define xisxdigit(x) isxdigit((unsigned char)x) -#define xisgraph(x) isgraph((unsigned char)x) - #if HAVE_RANDOM #define squid_random random #define squid_srandom srandom @@ -134,20 +102,6 @@ #define squid_srandom srand #endif -/* gcc doesn't recognize the Windows native 64 bit formatting tags causing - * the compile fail, so we must disable the check on native Windows. - */ - -#if __GNUC__ && !defined(_SQUID_MSWIN_) -#define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2))) -#define PRINTF_FORMAT_ARG2 __attribute__ ((format (printf, 2, 3))) -#define PRINTF_FORMAT_ARG3 __attribute__ ((format (printf, 3, 4))) -#else -#define PRINTF_FORMAT_ARG1 -#define PRINTF_FORMAT_ARG2 -#define PRINTF_FORMAT_ARG3 -#endif - /* * Determine if this is a leak check build or standard */ @@ -162,9 +116,4 @@ /* temp hack: needs to be pre-defined for now. */ #define SQUID_MAXPATHLEN 256 -/* - * strnstr() is needed. The OS may not provide a working copy. - */ -#include "strnstr.h" - #endif /* SQUID_CONFIG_H */ diff --git a/include/strnstr.h b/include/strnstr.h deleted file mode 100644 index 41731606bd..0000000000 --- a/include/strnstr.h +++ /dev/null @@ -1,11 +0,0 @@ -#if HAVE_STRNSTR - -/* Is strnstr exists and is usable we do so. */ -#define squid_strnstr(a,b,c) strnstr(a,b,c) - -#else /* not HAVE_STRNSTR */ - -/* If its not usable we have our own copy imported from FreeBSD */ -const char * squid_strnstr(const char *s, const char *find, size_t slen); - -#endif /* HAVE_STRNSTR*/ diff --git a/lib/Makefile.am b/lib/Makefile.am index 01366d15bc..11bbba253f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -70,7 +70,6 @@ libmiscutil_la_SOURCES = \ rfc3596.c \ $(SNPRINTFSOURCE) \ Splay.cc \ - strnstr.cc \ stub_memaccount.c \ util.c \ xusleep.c \ diff --git a/snmplib/asn1.c b/snmplib/asn1.c index b2ccfde3dc..46b154ac5a 100644 --- a/snmplib/asn1.c +++ b/snmplib/asn1.c @@ -409,7 +409,7 @@ asn_parse_string(u_char * data, int *datalength, snmp_set_api_error(SNMPERR_ASN_DECODE); return (NULL); } - xmemcpy((char *) string, (char *) bufp, (int) asn_length); + memcpy((char *) string, (char *) bufp, (int) asn_length); *strlength = (int) asn_length; *datalength -= (int) asn_length + (bufp - data); return (bufp + asn_length); @@ -448,7 +448,7 @@ asn_build_string(u_char * data, int *datalength, snmp_set_api_error(SNMPERR_ASN_DECODE); return (NULL); } - xmemcpy((char *) data, (char *) string, strlength); + memcpy((char *) data, (char *) string, strlength); *datalength -= strlength; return (data + strlength); } @@ -587,7 +587,7 @@ asn_parse_length(u_char * data, u_int * length) return (NULL); } *length = (u_int) 0; - xmemcpy((char *) (length), (char *) data + 1, (int) lengthbyte); + memcpy((char *) (length), (char *) data + 1, (int) lengthbyte); *length = ntohl(*length); *length >>= (8 * ((sizeof *length) - lengthbyte)); return (data + lengthbyte + 1); @@ -818,7 +818,7 @@ asn_build_objid(u_char * data, int *datalength, snmp_set_api_error(SNMPERR_ASN_DECODE); return (NULL); } - xmemcpy((char *) data, (char *) buf, asnlength); + memcpy((char *) data, (char *) buf, asnlength); *datalength -= asnlength; return (data + asnlength); } @@ -932,7 +932,7 @@ asn_parse_bitstring(u_char * data, int *datalength, snmp_set_api_error(SNMPERR_ASN_DECODE); return (NULL); } - xmemcpy((char *) string, (char *) bufp, (int) asn_length); + memcpy((char *) string, (char *) bufp, (int) asn_length); *strlength = (int) asn_length; *datalength -= (int) asn_length + (bufp - data); return (bufp + asn_length); @@ -973,7 +973,7 @@ asn_build_bitstring(u_char * data, int *datalength, snmp_set_api_error(SNMPERR_ASN_ENCODE); return (NULL); } - xmemcpy((char *) data, (char *) string, strlength); + memcpy((char *) data, (char *) string, strlength); *datalength -= strlength; return (data + strlength); } diff --git a/snmplib/snmp_pdu.c b/snmplib/snmp_pdu.c index 418e4969c2..94fe830ded 100644 --- a/snmplib/snmp_pdu.c +++ b/snmplib/snmp_pdu.c @@ -150,7 +150,7 @@ snmp_pdu_clone(struct snmp_pdu *Src) { snmp_set_api_error(SNMPERR_OS_ERR); return (NULL); } - xmemcpy((char *) Dest, (char *) Src, sizeof(struct snmp_pdu)); + memcpy((char *) Dest, (char *) Src, sizeof(struct snmp_pdu)); #if DEBUG_PDU snmplib_debug(8, "PDU %x: Created %x\n", (unsigned int) Src, (unsigned int) Dest); @@ -518,7 +518,7 @@ snmp_pdu_decode(u_char * Packet, /* data */ snmp_set_api_error(SNMPERR_OS_ERR); return (NULL); } - xmemcpy((char *) PDU->enterprise, (char *) objid, + memcpy((char *) PDU->enterprise, (char *) objid, PDU->enterprise_length * sizeof(oid)); /* Agent-addr */ diff --git a/snmplib/snmp_vars.c b/snmplib/snmp_vars.c index 09d5680051..ed3c581eaa 100644 --- a/snmplib/snmp_vars.c +++ b/snmplib/snmp_vars.c @@ -141,7 +141,7 @@ snmp_var_new(oid * Name, int Len) { /* Only copy a name if it was specified. */ if (Name) - xmemcpy((char *) New->name, (char *) Name, Len * sizeof(oid)); + memcpy((char *) New->name, (char *) Name, Len * sizeof(oid)); return (New); } @@ -179,7 +179,7 @@ snmp_var_clone(struct variable_list *Src) { sizeof(struct variable_list)); #endif - xmemcpy((char *) Dest, (char *) Src, sizeof(struct variable_list)); + memcpy((char *) Dest, (char *) Src, sizeof(struct variable_list)); if (Src->name != NULL) { Dest->name = (oid *) xmalloc(Src->name_length * sizeof(oid)); @@ -191,7 +191,7 @@ snmp_var_clone(struct variable_list *Src) { #if DEBUG_VARS printf("VARS: Copying name OID. (Size %d)\n", Src->name_length); #endif - xmemcpy((char *) Dest->name, (char *) Src->name, + memcpy((char *) Dest->name, (char *) Src->name, Src->name_length * sizeof(oid)); } /* CISCO Catalyst 2900 returns NULL strings as data of length 0. */ @@ -207,7 +207,7 @@ snmp_var_clone(struct variable_list *Src) { #if DEBUG_VARS printf("VARS: Copying value (Size %d)\n", Src->val_len); #endif - xmemcpy((char *) Dest->val.string, (char *) Src->val.string, Src->val_len); + memcpy((char *) Dest->val.string, (char *) Src->val.string, Src->val_len); } #if DEBUG_VARS printf("VARS: Cloned %x.\n", (unsigned int) Dest); @@ -530,7 +530,7 @@ snmp_var_DecodeVarBind(u_char * Buffer, int *BufLen, } /* Only copy if we successfully decoded something */ if (bufp) { - xmemcpy((char *) Var->val.objid, (char *) TmpBuf, Var->val_len); + memcpy((char *) Var->val.objid, (char *) TmpBuf, Var->val_len); } #if DEBUG_VARS_DECODE printf("VARS: Decoded OBJID (length %d) (%d bytes left)\n", diff --git a/src/CacheDigest.cc b/src/CacheDigest.cc index 6f0988abba..0830c480f6 100644 --- a/src/CacheDigest.cc +++ b/src/CacheDigest.cc @@ -102,7 +102,7 @@ cacheDigestClone(const CacheDigest * cd) clone->count = cd->count; clone->del_count = cd->del_count; assert(cd->mask_size == clone->mask_size); - xmemcpy(clone->mask, cd->mask, cd->mask_size); + memcpy(clone->mask, cd->mask, cd->mask_size); return clone; } @@ -328,7 +328,7 @@ cacheDigestHashKey(const CacheDigest * cd, const cache_key * key) const unsigned int bit_count = cd->mask_size * 8; unsigned int tmp_keys[4]; /* we must memcpy to ensure alignment */ - xmemcpy(tmp_keys, key, sizeof(tmp_keys)); + memcpy(tmp_keys, key, sizeof(tmp_keys)); hashed_keys[0] = htonl(tmp_keys[0]) % bit_count; hashed_keys[1] = htonl(tmp_keys[1]) % bit_count; hashed_keys[2] = htonl(tmp_keys[2]) % bit_count; diff --git a/src/CpuAffinitySet.cc b/src/CpuAffinitySet.cc index dded9f8f49..80e1406357 100644 --- a/src/CpuAffinitySet.cc +++ b/src/CpuAffinitySet.cc @@ -38,7 +38,7 @@ CpuAffinitySet::apply() "this process: " << xstrerror()); } else { cpu_set_t cpuSet; - xmemcpy(&cpuSet, &theCpuSet, sizeof(cpuSet)); + memcpy(&cpuSet, &theCpuSet, sizeof(cpuSet)); CPU_AND(&cpuSet, &cpuSet, &theOrigCpuSet); if (CPU_COUNT(&cpuSet) <= 0) { debugs(54, DBG_IMPORTANT, "ERROR: invalid CPU affinity for process " @@ -76,5 +76,5 @@ CpuAffinitySet::applied() const void CpuAffinitySet::set(const cpu_set_t &aCpuSet) { - xmemcpy(&theCpuSet, &aCpuSet, sizeof(theCpuSet)); + memcpy(&theCpuSet, &aCpuSet, sizeof(theCpuSet)); } diff --git a/src/DiskIO/DiskDaemon/DiskdFile.cc b/src/DiskIO/DiskDaemon/DiskdFile.cc index 398431b991..10e6c52137 100644 --- a/src/DiskIO/DiskDaemon/DiskdFile.cc +++ b/src/DiskIO/DiskDaemon/DiskdFile.cc @@ -312,7 +312,7 @@ DiskdFile::write(WriteRequest *aRequest) debugs(79, 3, "DiskdFile::write: this " << (void *)this << ", buf " << (void *)aRequest->buf << ", off " << aRequest->offset << ", len " << aRequest->len); ssize_t shm_offset; char *sbuf = (char *)IO->shm.get(&shm_offset); - xmemcpy(sbuf, aRequest->buf, aRequest->len); + memcpy(sbuf, aRequest->buf, aRequest->len); if (aRequest->free_func) aRequest->free_func(const_cast(aRequest->buf)); diff --git a/src/DiskIO/DiskThreads/aiops.cc b/src/DiskIO/DiskThreads/aiops.cc index dadcfed3ed..38a54a0bf2 100644 --- a/src/DiskIO/DiskThreads/aiops.cc +++ b/src/DiskIO/DiskThreads/aiops.cc @@ -587,8 +587,7 @@ squidaio_cleanup_request(squidaio_request_t * requestp) case _AIO_OP_STAT: if (!cancelled && requestp->ret == 0) - - xmemcpy(requestp->statp, requestp->tmpstatp, sizeof(struct stat)); + memcpy(requestp->statp, requestp->tmpstatp, sizeof(struct stat)); squidaio_xfree(requestp->tmpstatp, sizeof(struct stat)); diff --git a/src/DiskIO/DiskThreads/aiops_win32.cc b/src/DiskIO/DiskThreads/aiops_win32.cc index 0440a92a7a..7fcb2526ae 100644 --- a/src/DiskIO/DiskThreads/aiops_win32.cc +++ b/src/DiskIO/DiskThreads/aiops_win32.cc @@ -672,8 +672,7 @@ squidaio_cleanup_request(squidaio_request_t * requestp) case _AIO_OP_STAT: if (!cancelled && requestp->ret == 0) - - xmemcpy(requestp->statp, requestp->tmpstatp, sizeof(struct stat)); + memcpy(requestp->statp, requestp->tmpstatp, sizeof(struct stat)); squidaio_xfree(requestp->tmpstatp, sizeof(struct stat)); diff --git a/src/MemBuf.cc b/src/MemBuf.cc index 70480bec65..46c5ec1fc6 100644 --- a/src/MemBuf.cc +++ b/src/MemBuf.cc @@ -217,7 +217,7 @@ void MemBuf::consume(mb_size_t shiftSize) PROF_start(MemBuf_consume); if (shiftSize > 0) { if (shiftSize < cSize) - xmemmove(buf, buf + shiftSize, cSize - shiftSize); + memmove(buf, buf + shiftSize, cSize - shiftSize); size -= shiftSize; @@ -251,9 +251,7 @@ void MemBuf::append(const char *newContent, mb_size_t sz) grow(size + sz + 1); assert(size + sz <= capacity); /* paranoid */ - - xmemcpy(space(), newContent, sz); - + memcpy(space(), newContent, sz); appended(sz); } PROF_stop(MemBuf_append); diff --git a/src/MemObject.cc b/src/MemObject.cc index 1f93fe93cb..e4b48b7b78 100644 --- a/src/MemObject.cc +++ b/src/MemObject.cc @@ -57,7 +57,7 @@ url_checksum(const char *url) SquidMD5Init(&M); SquidMD5Update(&M, (unsigned char *) url, strlen(url)); SquidMD5Final(digest, &M); - xmemcpy(&ck, digest, sizeof(ck)); + memcpy(&ck, digest, sizeof(ck)); return ck; } diff --git a/src/StatHist.cc b/src/StatHist.cc index eaac62c53c..f224ea92d9 100644 --- a/src/StatHist.cc +++ b/src/StatHist.cc @@ -128,7 +128,7 @@ statHistCopy(StatHist * Dest, const StatHist * Orig) (long int) (Dest->capacity * sizeof(*Dest->bins)) << " bytes to " << Dest->bins << " from " << Orig->bins); - xmemcpy(Dest->bins, Orig->bins, Dest->capacity * sizeof(*Dest->bins)); + memcpy(Dest->bins, Orig->bins, Dest->capacity * sizeof(*Dest->bins)); } /* diff --git a/src/StoreMeta.cc b/src/StoreMeta.cc index 4065a4854c..f784a8c209 100644 --- a/src/StoreMeta.cc +++ b/src/StoreMeta.cc @@ -158,7 +158,7 @@ StoreMeta::Factory (char type, size_t len, void const *value) result->length = len; result->value = xmalloc(len); - xmemcpy(result->value, value, len); + memcpy(result->value, value, len); return result; } diff --git a/src/StoreMetaUnpacker.cc b/src/StoreMetaUnpacker.cc index e9e1b266f8..a92165192a 100644 --- a/src/StoreMetaUnpacker.cc +++ b/src/StoreMetaUnpacker.cc @@ -63,7 +63,7 @@ StoreMetaUnpacker::isBufferSane() void StoreMetaUnpacker::getBufferLength() { - xmemcpy(hdr_len, &buf[1], sizeof(int)); + memcpy(hdr_len, &buf[1], sizeof(int)); } StoreMetaUnpacker::StoreMetaUnpacker (char const *aBuffer, ssize_t aLen, int *anInt) : buf (aBuffer), buflen(aLen), hdr_len(anInt), position(1 + sizeof(int)) @@ -80,7 +80,7 @@ StoreMetaUnpacker::getType() void StoreMetaUnpacker::getLength() { - xmemcpy(&length, &buf[position], sizeof(int)); + memcpy(&length, &buf[position], sizeof(int)); position += sizeof(int); } diff --git a/src/String.cc b/src/String.cc index c86696a86f..7bdb48ba8f 100644 --- a/src/String.cc +++ b/src/String.cc @@ -130,7 +130,7 @@ String::allocAndFill(const char *str, int len) assert(this && str); allocBuffer(len + 1); len_ = len; - xmemcpy(buf_, str, len); + memcpy(buf_, str, len); buf_[len] = '\0'; PROF_stop(StringAllocAndFill); } @@ -200,10 +200,10 @@ String::append(const char *str, int len) snew.allocBuffer(snew.len_ + 1); if (len_) - xmemcpy(snew.buf_, rawBuf(), len_); + memcpy(snew.buf_, rawBuf(), len_); if (len) - xmemcpy(snew.buf_ + len_, str, len); + memcpy(snew.buf_ + len_, str, len); snew.buf_[snew.len_] = '\0'; diff --git a/src/acl/Asn.cc b/src/acl/Asn.cc index 552a2e9670..2137edf3e4 100644 --- a/src/acl/Asn.cc +++ b/src/acl/Asn.cc @@ -341,7 +341,7 @@ asHandleReply(void *data, StoreIOBuffer result) * Next, copy the left over data, from s to s + leftoversz to the * beginning of the buffer */ - xmemmove(buf, s, leftoversz); + memmove(buf, s, leftoversz); /* * Next, update our offset and reqofs, and kick off a copy if required diff --git a/src/acl/TimeData.cc b/src/acl/TimeData.cc index c2d677395f..f90a269d13 100644 --- a/src/acl/TimeData.cc +++ b/src/acl/TimeData.cc @@ -77,8 +77,7 @@ ACLTimeData::match(time_t when) if (when != last_when) { last_when = when; - - xmemcpy(&tm, localtime(&when), sizeof(struct tm)); + memcpy(&tm, localtime(&when), sizeof(struct tm)); } t = (time_t) (tm.tm_hour * 60 + tm.tm_min); diff --git a/src/cache_diff.cc b/src/cache_diff.cc index 782dc6f2a7..94be60f183 100644 --- a/src/cache_diff.cc +++ b/src/cache_diff.cc @@ -81,7 +81,7 @@ cacheEntryCreate(const StoreSwapLogData * s) CacheEntry *e = xcalloc(1, sizeof(CacheEntry)); assert(s); /* e->s = *s; */ - xmemcpy(e->key_arr, s->key, SQUID_MD5_DIGEST_LENGTH); + memcpy(e->key_arr, s->key, SQUID_MD5_DIGEST_LENGTH); e->key = &e->key_arr[0]; return e; } diff --git a/src/client_side.cc b/src/client_side.cc index 229cb1179c..4d0d54530e 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -2332,8 +2332,7 @@ connNoteUseOfBuffer(ConnStateData* conn, size_t byteCount) */ if (conn->in.notYetUsed > 0) - xmemmove(conn->in.buf, conn->in.buf + byteCount, - conn->in.notYetUsed); + memmove(conn->in.buf, conn->in.buf + byteCount, conn->in.notYetUsed); } /// respond with ERR_TOO_BIG if request header exceeds request_header_max_size @@ -2624,7 +2623,7 @@ static void connStripBufferWhitespace (ConnStateData * conn) { while (conn->in.notYetUsed > 0 && xisspace(conn->in.buf[0])) { - xmemmove(conn->in.buf, conn->in.buf + 1, conn->in.notYetUsed - 1); + memmove(conn->in.buf, conn->in.buf + 1, conn->in.notYetUsed - 1); --conn->in.notYetUsed; } } @@ -2827,7 +2826,7 @@ ConnStateData::handleReadData(char *buf, size_t size) char *current_buf = in.addressToReadInto(); if (buf != current_buf) - xmemmove(current_buf, buf, size); + memmove(current_buf, buf, size); in.notYetUsed += size; diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index c7b06a10f8..d6ada937d2 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -2056,7 +2056,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result) if (buf != result.data) { /* we've got to copy some data */ assert(result.length <= next()->readBuffer.length); - xmemcpy(buf, result.data, result.length); + memcpy(buf, result.data, result.length); body_buf = buf; } diff --git a/src/comm_select.cc b/src/comm_select.cc index 46c39664c3..5b8b40a3bc 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -380,10 +380,10 @@ comm_select(int msec) maxfd = Biggest_FD + 1; - xmemcpy(&readfds, &global_readfds, + memcpy(&readfds, &global_readfds, howmany(maxfd, FD_MASK_BITS) * FD_MASK_BYTES); - xmemcpy(&writefds, &global_writefds, + memcpy(&writefds, &global_writefds, howmany(maxfd, FD_MASK_BITS) * FD_MASK_BYTES); /* remove stalled FDs, and deal with pending descriptors */ diff --git a/src/comm_select_win32.cc b/src/comm_select_win32.cc index 58c93cb576..74a13089f7 100644 --- a/src/comm_select_win32.cc +++ b/src/comm_select_win32.cc @@ -380,11 +380,11 @@ comm_select(int msec) maxfd = Biggest_FD + 1; - xmemcpy(&readfds, &global_readfds, sizeof(global_readfds)); + memcpy(&readfds, &global_readfds, sizeof(global_readfds)); - xmemcpy(&writefds, &global_writefds, sizeof(global_writefds)); + memcpy(&writefds, &global_writefds, sizeof(global_writefds)); - xmemcpy(&errfds, &global_writefds, sizeof(global_writefds)); + memcpy(&errfds, &global_writefds, sizeof(global_writefds)); /* remove stalled FDs, and deal with pending descriptors */ pending = 0; diff --git a/src/disk.cc b/src/disk.cc index 85936a4ed0..88257e9649 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -196,7 +196,7 @@ diskCombineWrites(struct _fde_disk *fdd) dwrite_q *q = fdd->write_q; len = q->len - q->buf_offset; - xmemcpy(wq->buf + wq->len, q->buf + q->buf_offset, len); + memcpy(wq->buf + wq->len, q->buf + q->buf_offset, len); wq->len += len; fdd->write_q = q->next; diff --git a/src/dns_internal.cc b/src/dns_internal.cc index c6fe4a04f4..95dd38a277 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -278,7 +278,7 @@ idnsAddNameserver(const char *buf) nameservers = (ns *)xcalloc(nns_alloc, sizeof(*nameservers)); if (oldptr && oldalloc) - xmemcpy(nameservers, oldptr, oldalloc * sizeof(*nameservers)); + memcpy(nameservers, oldptr, oldalloc * sizeof(*nameservers)); if (oldptr) safe_free(oldptr); @@ -310,7 +310,7 @@ idnsAddPathComponent(const char *buf) searchpath = (sp *)xcalloc(npc_alloc, sizeof(*searchpath)); if (oldptr && oldalloc) - xmemcpy(searchpath, oldptr, oldalloc * sizeof(*searchpath)); + memcpy(searchpath, oldptr, oldalloc * sizeof(*searchpath)); if (oldptr) safe_free(oldptr); diff --git a/src/esi/Esi.cc b/src/esi/Esi.cc index 88e85884ad..7f0cceb10c 100644 --- a/src/esi/Esi.cc +++ b/src/esi/Esi.cc @@ -640,7 +640,7 @@ ESIContext::send () assert (len != 0 || rep != NULL); if (len) { - xmemcpy (next->readBuffer.data, &outbound->buf[outbound_offset], len); + memcpy(next->readBuffer.data, &outbound->buf[outbound_offset], len); if (len + outbound_offset == outbound->len) { ESISegment::Pointer temp = outbound->next; @@ -798,7 +798,7 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply &context->incoming->buf[context->incoming->len] << " because our buffer was not used"); - xmemcpy (&context->incoming->buf[context->incoming->len], receivedData.data, len); + memcpy(&context->incoming->buf[context->incoming->len], receivedData.data, len); context->incoming->len += len; if (context->incoming->len == HTTP_REQBUF_SZ) { @@ -809,7 +809,7 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply if (len != receivedData.length) { /* capture the remnants */ - xmemcpy (context->incoming->buf, &receivedData.data[len], receivedData.length - len); + memcpy(context->incoming->buf, &receivedData.data[len], receivedData.length - len); context->incoming->len = receivedData.length - len; } @@ -2296,7 +2296,7 @@ ElementList::pop_front (size_t const count) if (!count) return; - xmemmove (elements, &elements[count], (elementcount - count) * sizeof (ESIElement::Pointer)); + memmove(elements, &elements[count], (elementcount - count) * sizeof (ESIElement::Pointer)); elementcount -= count; } diff --git a/src/esi/Include.cc b/src/esi/Include.cc index 797fbd3fdb..54880c5349 100644 --- a/src/esi/Include.cc +++ b/src/esi/Include.cc @@ -140,7 +140,7 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply * if (receivedData.data != esiStream->localbuffer->buf) { /* But not the start of it */ - xmemmove (esiStream->localbuffer->buf, receivedData.data, receivedData.length); + memmove(esiStream->localbuffer->buf, receivedData.data, receivedData.length); } esiStream->localbuffer->len = receivedData.length; diff --git a/src/esi/Segment.cc b/src/esi/Segment.cc index a6f9df604d..8ed6ddc6a4 100644 --- a/src/esi/Segment.cc +++ b/src/esi/Segment.cc @@ -114,7 +114,7 @@ ESISegment::listToChar() const size_t pos = 0; while (temp.getRaw()) { - xmemcpy (&rv[pos], temp->buf, temp->len); + memcpy(&rv[pos], temp->buf, temp->len); pos += temp->len; temp = temp->next; } @@ -179,7 +179,7 @@ size_t ESISegment::append(char const *appendBuffer, size_t appendLength) { size_t toCopy = min(appendLength, space()); - xmemcpy (&buf[len], appendBuffer, toCopy); + memcpy(&buf[len], appendBuffer, toCopy); len += toCopy; return toCopy; } diff --git a/src/filemap.cc b/src/filemap.cc index e7dcc6b034..d6d41ad1c9 100644 --- a/src/filemap.cc +++ b/src/filemap.cc @@ -78,7 +78,7 @@ file_map_grow(fileMap * fm) debugs(8, 3, "file_map_grow: creating space for " << fm->max_n_files << " files"); fm->file_map = (unsigned long *)xcalloc(fm->nwords, sizeof(*fm->file_map)); debugs(8, 3, "copying " << old_sz << " old bytes"); - xmemcpy(fm->file_map, old_map, old_sz); + memcpy(fm->file_map, old_map, old_sz); xfree(old_map); /* XXX account fm->file_map */ } diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index 3f900c7a21..7b84624077 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -201,11 +201,11 @@ CossSwapDir::readCompleted(const char *buf, int len, int errflag, RefCountreadbuffer = (char *)xmalloc(cstate->st_size); p = storeCossMemPointerFromDiskOffset(storeCossFilenoToDiskOffset(sio->swap_filen), NULL); - xmemcpy(cstate->readbuffer, p, cstate->st_size); + memcpy(cstate->readbuffer, p, cstate->st_size); } sio->offset_ += len; - xmemcpy(cstate->requestbuf, &cstate->readbuffer[cstate->requestoffset], + memcpy(cstate->requestbuf, &cstate->readbuffer[cstate->requestoffset], cstate->requestlen); rlen = (size_t) cstate->requestlen; } @@ -785,8 +785,8 @@ CossCleanLog::write(StoreEntry const &e) s.swap_file_sz = e.swap_file_sz; s.refcount = e.refcount; s.flags = e.flags; - xmemcpy(&s.key, e.key, SQUID_MD5_DIGEST_LENGTH); - xmemcpy(outbuf + outbuf_offset, &s, ss); + memcpy(&s.key, e.key, SQUID_MD5_DIGEST_LENGTH); + memcpy(outbuf + outbuf_offset, &s, ss); outbuf_offset += ss; /* buffered write */ @@ -890,7 +890,7 @@ CossSwapDir::logEntry(const StoreEntry & e, int op) const s->swap_file_sz = e.swap_file_sz; s->refcount = e.refcount; s->flags = e.flags; - xmemcpy(s->key, e.key, SQUID_MD5_DIGEST_LENGTH); + memcpy(s->key, e.key, SQUID_MD5_DIGEST_LENGTH); file_write(swaplog_fd, -1, s, diff --git a/src/fs/coss/store_io_coss.cc b/src/fs/coss/store_io_coss.cc index b82d71c012..659395d85a 100644 --- a/src/fs/coss/store_io_coss.cc +++ b/src/fs/coss/store_io_coss.cc @@ -221,7 +221,7 @@ CossSwapDir::openStoreIO(StoreEntry & e, StoreIOState::STFNCB * file_callback, if (p) { cstate->readbuffer = (char *)xmalloc(cstate->st_size); - xmemcpy(cstate->readbuffer, p, cstate->st_size); + memcpy(cstate->readbuffer, p, cstate->st_size); StoreFScoss::GetInstance().stats.open_mem_hits++; } else { /* Do the allocation */ @@ -344,7 +344,7 @@ CossState::write(char const *buf, size_t size, off_t offset, FREE * free_func) CossSwapDir *SD = (CossSwapDir *)INDEXSD(swap_dirn); dest = SD->storeCossMemPointerFromDiskOffset(diskoffset, &membuf); assert(dest != NULL); - xmemcpy(dest, buf, size); + memcpy(dest, buf, size); offset_ += size; if (free_func) diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index d364a87b12..9d514f47e4 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -882,7 +882,7 @@ UFSSwapDir::writeCleanStart() state->outbuf = (char *)xcalloc(CLEAN_BUF_SZ, 1); state->outbuf_offset = 0; /*copy the header */ - xmemcpy(state->outbuf, &header, sizeof(StoreSwapLogHeader)); + memcpy(state->outbuf, &header, sizeof(StoreSwapLogHeader)); state->outbuf_offset += header.record_size; state->walker = repl->WalkInit(repl); @@ -931,8 +931,8 @@ UFSCleanLog::write(StoreEntry const &e) s.swap_file_sz = e.swap_file_sz; s.refcount = e.refcount; s.flags = e.flags; - xmemcpy(&s.key, e.key, SQUID_MD5_DIGEST_LENGTH); - xmemcpy(outbuf + outbuf_offset, &s, ss); + memcpy(&s.key, e.key, SQUID_MD5_DIGEST_LENGTH); + memcpy(outbuf + outbuf_offset, &s, ss); outbuf_offset += ss; /* buffered write */ @@ -1040,7 +1040,7 @@ UFSSwapDir::logEntry(const StoreEntry & e, int op) const s->swap_file_sz = e.swap_file_sz; s->refcount = e.refcount; s->flags = e.flags; - xmemcpy(s->key, e.key, SQUID_MD5_DIGEST_LENGTH); + memcpy(s->key, e.key, SQUID_MD5_DIGEST_LENGTH); file_write(swaplog_fd, -1, s, diff --git a/src/fs/ufs/ufscommon.cc b/src/fs/ufs/ufscommon.cc index fcfbab3d7a..5c89a1d2ee 100644 --- a/src/fs/ufs/ufscommon.cc +++ b/src/fs/ufs/ufscommon.cc @@ -89,7 +89,7 @@ public: swapData.swap_file_sz = readData.swap_file_sz; swapData.refcount = readData.refcount; swapData.flags = readData.flags; - xmemcpy(swapData.key, readData.key, SQUID_MD5_DIGEST_LENGTH); + memcpy(swapData.key, readData.key, SQUID_MD5_DIGEST_LENGTH); return true; } }; @@ -137,7 +137,7 @@ public: swapData.swap_file_sz = readData.swap_file_sz; swapData.refcount = readData.refcount; swapData.flags = readData.flags; - xmemcpy(swapData.key, readData.key, SQUID_MD5_DIGEST_LENGTH); + memcpy(swapData.key, readData.key, SQUID_MD5_DIGEST_LENGTH); return true; } }; @@ -186,7 +186,7 @@ public: swapData.swap_file_sz = readData.swap_file_sz; swapData.refcount = readData.refcount; swapData.flags = readData.flags; - xmemcpy(swapData.key, readData.key, SQUID_MD5_DIGEST_LENGTH); + memcpy(swapData.key, readData.key, SQUID_MD5_DIGEST_LENGTH); return true; } }; @@ -370,7 +370,7 @@ struct InitStoreEntry : public unary_function { case STORE_META_KEY: assert(x.length == SQUID_MD5_DIGEST_LENGTH); - xmemcpy(index, x.value, SQUID_MD5_DIGEST_LENGTH); + memcpy(index, x.value, SQUID_MD5_DIGEST_LENGTH); break; case STORE_META_STD: @@ -396,7 +396,7 @@ struct InitStoreEntry : public unary_function { case STORE_META_STD_LFS: assert(x.length == STORE_HDR_METASIZE); - xmemcpy(&what->timestamp, x.value, STORE_HDR_METASIZE); + memcpy(&what->timestamp, x.value, STORE_HDR_METASIZE); break; default: diff --git a/src/ftp.cc b/src/ftp.cc index ed3f22dceb..a401ebffd3 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1767,8 +1767,7 @@ FtpStateData::handleControlReply() /* Got some data past the complete reply */ assert(bytes_used < ctrl.offset); ctrl.offset -= bytes_used; - xmemmove(ctrl.buf, ctrl.buf + bytes_used, - ctrl.offset); + memmove(ctrl.buf, ctrl.buf + bytes_used, ctrl.offset); } /* Move the last line of the reply message to ctrl.last_reply */ diff --git a/src/gopher.cc b/src/gopher.cc index 5b31f3a395..5204526241 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -467,7 +467,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len) len = TEMP_BUF_SIZE - gopherState->len; } - xmemcpy(gopherState->buf + gopherState->len, inbuf, len); + memcpy(gopherState->buf + gopherState->len, inbuf, len); gopherState->len += len; return; } @@ -498,7 +498,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len) } if (len > (pos - inbuf)) { - xmemcpy(gopherState->buf, pos, len - (pos - inbuf)); + memcpy(gopherState->buf, pos, len - (pos - inbuf)); gopherState->len = len - (pos - inbuf); } diff --git a/src/htcp.cc b/src/htcp.cc index 898189b763..df13aa591f 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -332,7 +332,7 @@ htcpBuildAuth(char *buf, size_t buflen) copy_sz += 2; if (buflen < copy_sz) return -1; - xmemcpy(buf, &auth, copy_sz); + memcpy(buf, &auth, copy_sz); return copy_sz; } @@ -357,7 +357,7 @@ htcpBuildCountstr(char *buf, size_t buflen, const char *s) length = htons((uint16_t) len); - xmemcpy(buf + off, &length, 2); + memcpy(buf + off, &length, 2); off += 2; @@ -365,7 +365,7 @@ htcpBuildCountstr(char *buf, size_t buflen, const char *s) return -1; if (len) - xmemcpy(buf + off, s, len); + memcpy(buf + off, s, len); off += len; @@ -473,7 +473,7 @@ htcpBuildClrOpData(char *buf, size_t buflen, htcpStuff * stuff) case RR_REQUEST: debugs(31, 3, "htcpBuildClrOpData: RR_REQUEST"); reason = htons((u_short)stuff->reason); - xmemcpy(buf, &reason, 2); + memcpy(buf, &reason, 2); return htcpBuildSpecifier(buf + 2, buflen - 2, stuff) + 2; case RR_RESPONSE: break; @@ -548,7 +548,7 @@ htcpBuildData(char *buf, size_t buflen, htcpStuff * stuff) hdr.msg_id = htonl(hdr.msg_id); if (!old_squid_format) { - xmemcpy(buf, &hdr, hdr_sz); + memcpy(buf, &hdr, hdr_sz); } else { htcpDataHeaderSquid hdrSquid; memset(&hdrSquid, 0, sizeof(hdrSquid)); @@ -557,7 +557,7 @@ htcpBuildData(char *buf, size_t buflen, htcpStuff * stuff) hdrSquid.response = hdr.response; hdrSquid.F1 = hdr.F1; hdrSquid.RR = hdr.RR; - xmemcpy(buf, &hdrSquid, hdr_sz); + memcpy(buf, &hdrSquid, hdr_sz); } debugs(31, 3, "htcpBuildData: size " << off); @@ -605,7 +605,7 @@ htcpBuildPacket(char *buf, size_t buflen, htcpStuff * stuff) else hdr.minor = 1; - xmemcpy(buf, &hdr, hdr_sz); + memcpy(buf, &hdr, hdr_sz); debugs(31, 3, "htcpBuildPacket: size " << off); @@ -1365,7 +1365,7 @@ htcpHandleMsg(char *buf, int sz, Ip::Address &from) } htcpHexdump("htcpHandle", buf, sz); - xmemcpy(&htcpHdr, buf, sizeof(htcpHeader)); + memcpy(&htcpHdr, buf, sizeof(htcpHeader)); htcpHdr.length = ntohs(htcpHdr.length); if (htcpHdr.minor == 0) @@ -1399,10 +1399,10 @@ htcpHandleMsg(char *buf, int sz, Ip::Address &from) } if (!old_squid_format) { - xmemcpy(&hdr, hbuf, sizeof(hdr)); + memcpy(&hdr, hbuf, sizeof(hdr)); } else { htcpDataHeaderSquid hdrSquid; - xmemcpy(&hdrSquid, hbuf, sizeof(hdrSquid)); + memcpy(&hdrSquid, hbuf, sizeof(hdrSquid)); hdr.length = hdrSquid.length; hdr.opcode = hdrSquid.opcode; hdr.response = hdrSquid.response; diff --git a/src/http.cc b/src/http.cc index d59403e4dd..3b5997f9ab 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1149,7 +1149,7 @@ HttpStateData::readReply(const CommIoCbParams &io) /* Skip whitespace between replies */ while (len > 0 && xisspace(*buf)) - xmemmove(buf, buf + 1, len--); + memmove(buf, buf + 1, len--); if (len == 0) { /* Continue to read... */ diff --git a/src/icmp/Icmp4.cc b/src/icmp/Icmp4.cc index ce221f9e7e..e2edfc8a13 100644 --- a/src/icmp/Icmp4.cc +++ b/src/icmp/Icmp4.cc @@ -130,7 +130,7 @@ Icmp4::SendEcho(Ip::Address &to, int opcode, const char *payload, int len) if (len > MAX_PAYLOAD) len = MAX_PAYLOAD; - xmemcpy(echo->payload, payload, len); + memcpy(echo->payload, payload, len); icmp_pktsize += len; } diff --git a/src/icmp/Icmp6.cc b/src/icmp/Icmp6.cc index e604754571..21dc01fedd 100644 --- a/src/icmp/Icmp6.cc +++ b/src/icmp/Icmp6.cc @@ -174,7 +174,7 @@ Icmp6::SendEcho(Ip::Address &to, int opcode, const char *payload, int len) if (len > MAX_PAYLOAD) len = MAX_PAYLOAD; - xmemcpy(echo->payload, payload, len); + memcpy(echo->payload, payload, len); icmp6_pktsize += len; } diff --git a/src/icmp/IcmpPinger.cc b/src/icmp/IcmpPinger.cc index 88398b4d54..35758b4907 100644 --- a/src/icmp/IcmpPinger.cc +++ b/src/icmp/IcmpPinger.cc @@ -93,7 +93,7 @@ IcmpPinger::Open(void) return -1; } - xmemcpy(&wpi, buf, sizeof(wpi)); + memcpy(&wpi, buf, sizeof(wpi)); write(1, "OK\n", 3); x = read(0, buf, sizeof(PS)); @@ -105,7 +105,7 @@ IcmpPinger::Open(void) return -1; } - xmemcpy(&PS, buf, sizeof(PS)); + memcpy(&PS, buf, sizeof(PS)); icmp_sock = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, &wpi, 0, 0); diff --git a/src/icmp/IcmpSquid.cc b/src/icmp/IcmpSquid.cc index f2b4899905..708f4f4866 100644 --- a/src/icmp/IcmpSquid.cc +++ b/src/icmp/IcmpSquid.cc @@ -105,7 +105,7 @@ IcmpSquid::SendEcho(Ip::Address &to, int opcode, const char *payload, int len) pecho.psize = len; if (len > 0) - xmemcpy(pecho.payload, payload, len); + memcpy(pecho.payload, payload, len); slen = sizeof(pingerEchoData) - PINGER_PAYLOAD_SZ + pecho.psize; diff --git a/src/icmp/net_db.cc b/src/icmp/net_db.cc index 016800d807..5bb0e499ca 100644 --- a/src/icmp/net_db.cc +++ b/src/icmp/net_db.cc @@ -620,7 +620,7 @@ netdbReloadState(void) n = (netdbEntry *)memAllocate(MEM_NETDBENTRY); - xmemcpy(n, &N, sizeof(netdbEntry)); + memcpy(n, &N, sizeof(netdbEntry)); netdbHashInsert(n, addr); @@ -778,21 +778,21 @@ netdbExchangeHandleReply(void *data, StoreIOBuffer receivedData) case NETDB_EX_NETWORK: o++; /* FIXME INET6 : NetDB can still ony send IPv4 */ - xmemcpy(&line_addr, p + o, sizeof(struct in_addr)); + memcpy(&line_addr, p + o, sizeof(struct in_addr)); addr = line_addr; o += sizeof(struct in_addr); break; case NETDB_EX_RTT: o++; - xmemcpy(&j, p + o, sizeof(int)); + memcpy(&j, p + o, sizeof(int)); o += sizeof(int); rtt = (double) ntohl(j) / 1000.0; break; case NETDB_EX_HOPS: o++; - xmemcpy(&j, p + o, sizeof(int)); + memcpy(&j, p + o, sizeof(int)); o += sizeof(int); hops = (double) ntohl(j) / 1000.0; break; @@ -1247,7 +1247,7 @@ netdbBinaryExchange(StoreEntry * s) buf[i++] = (char) NETDB_EX_NETWORK; addr.GetInAddr(line_addr); - xmemcpy(&buf[i], &line_addr, sizeof(struct in_addr)); + memcpy(&buf[i], &line_addr, sizeof(struct in_addr)); i += sizeof(struct in_addr); @@ -1255,7 +1255,7 @@ netdbBinaryExchange(StoreEntry * s) j = htonl((int) (n->rtt * 1000)); - xmemcpy(&buf[i], &j, sizeof(int)); + memcpy(&buf[i], &j, sizeof(int)); i += sizeof(int); @@ -1263,7 +1263,7 @@ netdbBinaryExchange(StoreEntry * s) j = htonl((int) (n->hops * 1000)); - xmemcpy(&buf[i], &j, sizeof(int)); + memcpy(&buf[i], &j, sizeof(int)); i += sizeof(int); diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 87b2a8369a..d09aea28aa 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -112,7 +112,7 @@ _icp_common_t::_icp_common_t(char *buf, unsigned int len) return; } - xmemcpy(this, buf, sizeof(icp_common_t)); + memcpy(this, buf, sizeof(icp_common_t)); /* * Convert network order sensitive fields */ @@ -291,7 +291,7 @@ _icp_common_t::createMessage( if (opcode == ICP_QUERY) urloffset += sizeof(uint32_t); - xmemcpy(urloffset, url, strlen(url)); + memcpy(urloffset, url, strlen(url)); return (icp_common_t *)buf; } diff --git a/src/ipc/TypedMsgHdr.cc b/src/ipc/TypedMsgHdr.cc index a49527e5fd..0f2116cc72 100644 --- a/src/ipc/TypedMsgHdr.cc +++ b/src/ipc/TypedMsgHdr.cc @@ -20,14 +20,14 @@ Ipc::TypedMsgHdr::TypedMsgHdr() Ipc::TypedMsgHdr::TypedMsgHdr(const TypedMsgHdr &tmh) { - xmemcpy(this, &tmh, sizeof(*this)); + memcpy(this, &tmh, sizeof(*this)); sync(); } Ipc::TypedMsgHdr &Ipc::TypedMsgHdr::operator =(const TypedMsgHdr &tmh) { if (this != &tmh) { // skip assignment to self - xmemcpy(this, &tmh, sizeof(*this)); + memcpy(this, &tmh, sizeof(*this)); sync(); } return *this; @@ -156,7 +156,7 @@ Ipc::TypedMsgHdr::getRaw(void *raw, size_t size) const Must(size >= 0); if (size > 0) { Must(size <= data.size - offset); - xmemcpy(raw, data.raw + offset, size); + memcpy(raw, data.raw + offset, size); offset += size; } } @@ -168,7 +168,7 @@ Ipc::TypedMsgHdr::putRaw(const void *raw, size_t size) Must(size >= 0); if (size > 0) { Must(size <= sizeof(data.raw) - data.size); - xmemcpy(data.raw + data.size, raw, size); + memcpy(data.raw + data.size, raw, size); data.size += size; } } @@ -187,7 +187,7 @@ Ipc::TypedMsgHdr::putFd(int fd) cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fdCount); int *fdStore = reinterpret_cast(CMSG_DATA(cmsg)); - xmemcpy(fdStore, &fd, fdCount * sizeof(int)); + memcpy(fdStore, &fd, fdCount * sizeof(int)); msg_controllen = cmsg->cmsg_len; } @@ -203,7 +203,7 @@ Ipc::TypedMsgHdr::getFd() const const int fdCount = 1; const int *fdStore = reinterpret_cast(CMSG_DATA(cmsg)); int fd = -1; - xmemcpy(&fd, fdStore, fdCount * sizeof(int)); + memcpy(&fd, fdStore, fdCount * sizeof(int)); return fd; } diff --git a/src/ipcache.cc b/src/ipcache.cc index 45e7fc1620..926b906e5c 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -535,7 +535,7 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m continue; struct in_addr temp; - xmemcpy(&temp, answers[k].rdata, sizeof(struct in_addr)); + memcpy(&temp, answers[k].rdata, sizeof(struct in_addr)); i->addrs.in_addrs[j] = temp; debugs(14, 3, "ipcacheParse: " << name << " #" << j << " " << i->addrs.in_addrs[j]); @@ -546,7 +546,7 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m continue; struct in6_addr temp; - xmemcpy(&temp, answers[k].rdata, sizeof(struct in6_addr)); + memcpy(&temp, answers[k].rdata, sizeof(struct in6_addr)); i->addrs.in_addrs[j] = temp; debugs(14, 3, "ipcacheParse: " << name << " #" << j << " " << i->addrs.in_addrs[j] ); diff --git a/src/log/ModDaemon.cc b/src/log/ModDaemon.cc index b987d95092..d1f0fcf5e5 100644 --- a/src/log/ModDaemon.cc +++ b/src/log/ModDaemon.cc @@ -191,7 +191,7 @@ logfile_mod_daemon_append(Logfile * lf, const char *buf, int len) b = static_cast(ll->bufs.tail->data); debugs(50, 3, "logfile_mod_daemon_append: current buffer has " << b->len << " of " << b->size << " bytes before append"); s = min(len, (b->size - b->len)); - xmemcpy(b->buf + b->len, buf, s); + memcpy(b->buf + b->len, buf, s); len = len - s; buf = buf + s; b->len = b->len + s; diff --git a/src/log/ModStdio.cc b/src/log/ModStdio.cc index 7a009140c7..e9d704b68c 100644 --- a/src/log/ModStdio.cc +++ b/src/log/ModStdio.cc @@ -82,7 +82,7 @@ logfile_mod_stdio_writeline(Logfile * lf, const char *buf, size_t len) return; } /* buffer it */ - xmemcpy(ll->buf + ll->offset, buf, len); + memcpy(ll->buf + ll->offset, buf, len); ll->offset += len; diff --git a/src/log/ModTcp.cc b/src/log/ModTcp.cc index 816760b91a..4f5275c874 100644 --- a/src/log/ModTcp.cc +++ b/src/log/ModTcp.cc @@ -101,7 +101,7 @@ logfile_mod_tcp_writeline(Logfile * lf, const char *buf, size_t len) return; } /* buffer it */ - xmemcpy(ll->buf + ll->offset, buf, len); + memcpy(ll->buf + ll->offset, buf, len); ll->offset += len; diff --git a/src/log/ModUdp.cc b/src/log/ModUdp.cc index b33e38fc0a..ce373c83fe 100644 --- a/src/log/ModUdp.cc +++ b/src/log/ModUdp.cc @@ -99,7 +99,7 @@ logfile_mod_udp_writeline(Logfile * lf, const char *buf, size_t len) return; } /* buffer it */ - xmemcpy(ll->buf + ll->offset, buf, len); + memcpy(ll->buf + ll->offset, buf, len); ll->offset += len; diff --git a/src/pconn.cc b/src/pconn.cc index e2fcad7cbb..fbcf3fb7f8 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -115,7 +115,7 @@ IdleConnList::push(int fd) nfds_alloc <<= 1; int *old = fds; fds = (int *)xmalloc(nfds_alloc * sizeof(int)); - xmemcpy(fds, old, nfds * sizeof(int)); + memcpy(fds, old, nfds * sizeof(int)); if (nfds == PCONN_FDS_SZ) pconn_fds_pool->freeOne(old); diff --git a/src/peer_digest.cc b/src/peer_digest.cc index 4f009ec93e..d20525293e 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -491,7 +491,7 @@ peerDigestHandleReply(void *data, StoreIOBuffer receivedData) */ newsize = fetch->bufofs - retsize; - xmemmove(fetch->buf, fetch->buf + retsize, fetch->bufofs - newsize); + memmove(fetch->buf, fetch->buf + retsize, fetch->bufofs - newsize); fetch->bufofs = newsize; @@ -713,7 +713,7 @@ peerDigestSwapInMask(void *data, char *buf, ssize_t size) * NOTENOTENOTENOTENOTE: buf doesn't point to pd->cd->mask anymore! * we need to do the copy ourselves! */ - xmemcpy(pd->cd->mask + fetch->mask_offset, buf, size); + memcpy(pd->cd->mask + fetch->mask_offset, buf, size); /* NOTE! buf points to the middle of pd->cd->mask! */ @@ -988,7 +988,7 @@ peerDigestSetCBlock(PeerDigest * pd, const char *buf) int freed_size = 0; const char *host = pd->host.termedBuf(); - xmemcpy(&cblock, buf, sizeof(cblock)); + memcpy(&cblock, buf, sizeof(cblock)); /* network -> host conversions */ cblock.ver.current = ntohs(cblock.ver.current); cblock.ver.required = ntohs(cblock.ver.required); diff --git a/src/recv-announce.cc b/src/recv-announce.cc index 9a7fdcb767..a57fb4e443 100644 --- a/src/recv-announce.cc +++ b/src/recv-announce.cc @@ -121,7 +121,7 @@ main(int argc, char *argv[]) exit(2); } - xmemcpy(ip, &R.sin_addr.s_addr, 4); + memcpy(ip, &R.sin_addr.s_addr, 4); hp = gethostbyaddr(ip, 4, AF_INET); ipa = R.sin_addr; printf("==============================================================================\n"); diff --git a/src/snmp_core.cc b/src/snmp_core.cc index 807fdc473c..f3d13f8951 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -763,7 +763,7 @@ static_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn oid *instance = NULL; if (*len <= current->len) { instance = (oid *)xmalloc(sizeof(name) * (*len + 1)); - xmemcpy(instance, name, (sizeof(name) * *len)); + memcpy(instance, name, (sizeof(name) * *len)); instance[*len] = 0; *len += 1; } @@ -780,7 +780,7 @@ time_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn) if (*len <= current->len) { instance = (oid *)xmalloc(sizeof(name) * (*len + 1)); - xmemcpy(instance, name, (sizeof(name) * *len)); + memcpy(instance, name, (sizeof(name) * *len)); instance[*len] = *index; *len += 1; } else { @@ -791,7 +791,7 @@ time_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn) if (loop < (TIME_INDEX_LEN - 1)) { instance = (oid *)xmalloc(sizeof(name) * (*len)); - xmemcpy(instance, name, (sizeof(name) * *len)); + memcpy(instance, name, (sizeof(name) * *len)); instance[*len - 1] = index[++loop]; } } @@ -817,7 +817,7 @@ peer_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn) } else if (*len <= current->len) { debugs(49, 6, "snmp peer_Inst: *len <= current->len ???"); instance = (oid *)xmalloc(sizeof(name) * ( *len + 1)); - xmemcpy(instance, name, (sizeof(name) * *len)); + memcpy(instance, name, (sizeof(name) * *len)); instance[*len] = 1 ; *len += 1; } else { @@ -829,7 +829,7 @@ peer_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn) if (peers) { debugs(49, 6, "snmp peer_Inst: Encode peer #" << i); instance = (oid *)xmalloc(sizeof(name) * (current->len + 1 )); - xmemcpy(instance, name, (sizeof(name) * current->len )); + memcpy(instance, name, (sizeof(name) * current->len )); instance[current->len] = no + 1 ; // i.e. the next index on cache_peeer table. } else { debugs(49, 6, "snmp peer_Inst: We have " << i << " peers. Can't find #" << no); @@ -864,7 +864,7 @@ client_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn debugs(49, 6, HERE << "len" << *len << ", current-len" << current->len << ", addr=" << laddr << ", size=" << size); instance = (oid *)xmalloc(sizeof(name) * (*len + size )); - xmemcpy(instance, name, (sizeof(name) * (*len))); + memcpy(instance, name, (sizeof(name) * (*len))); if ( !laddr.IsAnyAddr() ) { addr2oid(laddr, &instance[ *len]); // the addr @@ -888,7 +888,7 @@ client_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn debugs(49, 6, HERE << "len" << *len << ", current-len" << current->len << ", addr=" << laddr << ", newshift=" << newshift); instance = (oid *)xmalloc(sizeof(name) * (current->len + newshift)); - xmemcpy(instance, name, (sizeof(name) * (current->len))); + memcpy(instance, name, (sizeof(name) * (current->len))); addr2oid(laddr, &instance[current->len]); // the addr. *len = current->len + newshift ; } diff --git a/src/stat.cc b/src/stat.cc index 706a1ac066..bcb28cbe72 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1425,7 +1425,7 @@ statAvgTick(void *notused) c->timestamp = current_time; /* even if NCountHist is small, we already Init()ed the tail */ statCountersClean(CountHist + N_COUNT_HIST - 1); - xmemmove(p, t, (N_COUNT_HIST - 1) * sizeof(StatCounters)); + memmove(p, t, (N_COUNT_HIST - 1) * sizeof(StatCounters)); statCountersCopy(t, c); NCountHist++; @@ -1435,7 +1435,7 @@ statAvgTick(void *notused) StatCounters *p2 = &CountHourHist[1]; StatCounters *c2 = &CountHist[N_COUNT_HIST - 1]; statCountersClean(CountHourHist + N_COUNT_HOUR_HIST - 1); - xmemmove(p2, t2, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters)); + memmove(p2, t2, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters)); statCountersCopy(t2, c2); NCountHourHist++; } @@ -1545,7 +1545,7 @@ statCountersCopy(StatCounters * dest, const StatCounters * orig) { assert(dest && orig); /* this should take care of all the fields, but "special" ones */ - xmemcpy(dest, orig, sizeof(*dest)); + memcpy(dest, orig, sizeof(*dest)); /* prepare space where to copy special entries */ statCountersInitSpecial(dest); /* now handle special cases */ diff --git a/src/stmem.cc b/src/stmem.cc index b264138f69..95257d6eb0 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -142,7 +142,7 @@ mem_hdr::writeAvailable(mem_node *aNode, int64_t location, size_t amount, char c assert (location - aNode->nodeBuffer.offset == (int64_t)aNode->nodeBuffer.length); size_t copyLen = min(amount, aNode->space()); - xmemcpy(aNode->nodeBuffer.data + aNode->nodeBuffer.length, source, copyLen); + memcpy(aNode->nodeBuffer.data + aNode->nodeBuffer.length, source, copyLen); if (inmem_hi <= location) inmem_hi = location + copyLen; @@ -218,7 +218,7 @@ mem_hdr::copyAvailable(mem_node *aNode, int64_t location, size_t amount, char *t size_t copyLen = min(amount, aNode->nodeBuffer.length - copyOffset); - xmemcpy(target, aNode->nodeBuffer.data + copyOffset, copyLen); + memcpy(target, aNode->nodeBuffer.data + copyOffset, copyLen); return copyLen; } diff --git a/src/store_client.cc b/src/store_client.cc index 50ac793d0b..fd9b3dd344 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -622,7 +622,7 @@ store_client::readHeader(char const *buf, ssize_t len) */ size_t copy_sz = min(copyInto.length, body_sz); debugs(90, 3, "storeClientReadHeader: copying " << copy_sz << " bytes of body"); - xmemmove(copyInto.data, copyInto.data + mem->swap_hdr_sz, copy_sz); + memmove(copyInto.data, copyInto.data + mem->swap_hdr_sz, copy_sz); readBody(copyInto.data, copy_sz); diff --git a/src/store_dir.cc b/src/store_dir.cc index ce7523e229..cf95024df8 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -624,7 +624,7 @@ allocate_new_swapdir(SquidConfig::_cacheSwap * swap) StorePointer *tmp; swap->n_allocated <<= 1; tmp = static_cast(xcalloc(swap->n_allocated, sizeof(StorePointer))); - xmemcpy(tmp, swap->swapDirs, swap->n_configured * sizeof(SwapDir *)); + memcpy(tmp, swap->swapDirs, swap->n_configured * sizeof(SwapDir *)); xfree(swap->swapDirs); swap->swapDirs = tmp; } diff --git a/src/store_key_md5.cc b/src/store_key_md5.cc index be83ca0a82..06f1377a4a 100644 --- a/src/store_key_md5.cc +++ b/src/store_key_md5.cc @@ -155,14 +155,14 @@ cache_key * storeKeyDup(const cache_key * key) { cache_key *dup = (cache_key *)memAllocate(MEM_MD5_DIGEST); - xmemcpy(dup, key, SQUID_MD5_DIGEST_LENGTH); + memcpy(dup, key, SQUID_MD5_DIGEST_LENGTH); return dup; } cache_key * storeKeyCopy(cache_key * dst, const cache_key * src) { - xmemcpy(dst, src, SQUID_MD5_DIGEST_LENGTH); + memcpy(dst, src, SQUID_MD5_DIGEST_LENGTH); return dst; } diff --git a/src/store_swapmeta.cc b/src/store_swapmeta.cc index 0fa50acaf4..ed17af445a 100644 --- a/src/store_swapmeta.cc +++ b/src/store_swapmeta.cc @@ -135,15 +135,15 @@ storeSwapMetaPack(tlv * tlv_list, int *length) buf[j++] = (char) STORE_META_OK; - xmemcpy(&buf[j], &buflen, sizeof(int)); + memcpy(&buf[j], &buflen, sizeof(int)); j += sizeof(int); for (t = tlv_list; t; t = t->next) { buf[j++] = t->getType(); - xmemcpy(&buf[j], &t->length, sizeof(int)); + memcpy(&buf[j], &t->length, sizeof(int)); j += sizeof(int); - xmemcpy(&buf[j], t->value, t->length); + memcpy(&buf[j], t->value, t->length); j += t->length; } diff --git a/src/test_cache_digest.cc b/src/test_cache_digest.cc index 489896500d..30ae1dbf09 100644 --- a/src/test_cache_digest.cc +++ b/src/test_cache_digest.cc @@ -225,7 +225,7 @@ cacheEntryCreate(const storeSwapLogData * s) CacheEntry *e = (CacheEntry *)xcalloc(1, sizeof(CacheEntry)); assert(s); /* e->s = *s; */ - xmemcpy(e->key_arr, s->key, SQUID_MD5_DIGEST_LENGTH); + memcpy(e->key_arr, s->key, SQUID_MD5_DIGEST_LENGTH); e->key = &e->key_arr[0]; return e; } @@ -491,7 +491,7 @@ accessLogReader(FileIterator * fi) * strcmp(hier, "SSL_PARENT_MISS") && * strcmp(hier, "DEFAULT_PARENT"); */ - xmemcpy(entry->key, storeKeyPublic(url, method_id), sizeof(entry->key)); + memcpy(entry->key, storeKeyPublic(url, method_id), sizeof(entry->key)); /*fprintf(stdout, "%s:%d: %s %s %s %s\n", * fname, count, method, storeKeyText(entry->key), url, hier); */ diff --git a/src/url.cc b/src/url.cc index 0e5d688cb8..24d635412d 100644 --- a/src/url.cc +++ b/src/url.cc @@ -934,7 +934,7 @@ URLHostName::trimAuth() if ((t = strrchr(Host, '@'))) { t++; - xmemmove(Host, t, strlen(t) + 1); + memmove(Host, t, strlen(t) + 1); } } diff --git a/src/urn.cc b/src/urn.cc index e96f2ad1df..8e1c4ad714 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -482,7 +482,7 @@ urnParseReply(const char *inbuf, const HttpRequestMethod& m) old = list; n <<= 2; list = (url_entry *)xcalloc(n + 1, sizeof(*list)); - xmemcpy(list, old, i * sizeof(*list)); + memcpy(list, old, i * sizeof(*list)); safe_free(old); } diff --git a/src/wccp.cc b/src/wccp.cc index 9f0f514798..fbe2e74e2d 100644 --- a/src/wccp.cc +++ b/src/wccp.cc @@ -354,7 +354,7 @@ wccpAssignBuckets(void) for (loop = 0; loop < number_caches; loop++) { int i; - xmemcpy(&caches[loop], + memcpy(&caches[loop], &wccp_i_see_you.wccp_cache_entry[loop].ip_addr, sizeof(*caches)); diff --git a/src/wccp2.cc b/src/wccp2.cc index f9af664b16..6f49e7af4a 100644 --- a/src/wccp2.cc +++ b/src/wccp2.cc @@ -744,13 +744,11 @@ wccp2Init(void) service_list_ptr->security_info = (struct wccp2_security_md5_t *) ptr; if (service_list_ptr->wccp2_security_type == WCCP2_MD5_SECURITY) { - - xmemcpy(ptr, &wccp2_security_md5, sizeof(struct wccp2_security_md5_t)); - + memcpy(ptr, &wccp2_security_md5, sizeof(struct wccp2_security_md5_t)); ptr += sizeof(struct wccp2_security_md5_t); } else { /* assume NONE, and XXX I hate magic length numbers */ - xmemcpy(ptr, &wccp2_security_md5, 8); + memcpy(ptr, &wccp2_security_md5, 8); ptr += 8; } @@ -760,7 +758,7 @@ wccp2Init(void) assert(wccp2_here_i_am_header.length <= WCCP_RESPONSE_SIZE); - xmemcpy(ptr, &service_list_ptr->info, sizeof(struct wccp2_service_info_t)); + memcpy(ptr, &service_list_ptr->info, sizeof(struct wccp2_service_info_t)); service_list_ptr->service_info = (struct wccp2_service_info_t *) ptr; @@ -783,7 +781,7 @@ wccp2Init(void) wccp2_identity_info.cache_identity.weight = htons(Config.Wccp2.weight); memset(&wccp2_identity_info.cache_identity.status, '\0', sizeof(wccp2_identity_info.cache_identity.status)); - xmemcpy(ptr, &wccp2_identity_info, sizeof(struct wccp2_identity_info_t)); + memcpy(ptr, &wccp2_identity_info, sizeof(struct wccp2_identity_info_t)); service_list_ptr->wccp2_identity_info_ptr = ptr; ptr += sizeof(struct wccp2_identity_info_t); @@ -817,7 +815,7 @@ wccp2Init(void) wccp2_mask_identity_info.cache_identity.weight = 0; wccp2_mask_identity_info.cache_identity.status = 0; - xmemcpy(ptr, &wccp2_mask_identity_info, sizeof(struct wccp2_mask_identity_info_t)); + memcpy(ptr, &wccp2_mask_identity_info, sizeof(struct wccp2_mask_identity_info_t)); service_list_ptr->wccp2_identity_info_ptr = ptr; ptr += sizeof(struct wccp2_mask_identity_info_t); @@ -839,7 +837,7 @@ wccp2Init(void) wccp2_cache_view_header.cache_view_version = htonl(1); - xmemcpy(ptr, &wccp2_cache_view_header, sizeof(wccp2_cache_view_header)); + memcpy(ptr, &wccp2_cache_view_header, sizeof(wccp2_cache_view_header)); ptr += sizeof(wccp2_cache_view_header); @@ -850,7 +848,7 @@ wccp2Init(void) service_list_ptr->num_routers = htonl(wccp2_numrouters); - xmemcpy(ptr, &service_list_ptr->num_routers, sizeof(service_list_ptr->num_routers)); + memcpy(ptr, &service_list_ptr->num_routers, sizeof(service_list_ptr->num_routers)); ptr += sizeof(service_list_ptr->num_routers); @@ -890,7 +888,7 @@ wccp2Init(void) wccp2_cache_view_info.num_caches = htonl(0); - xmemcpy(ptr, &wccp2_cache_view_info.num_caches, sizeof(wccp2_cache_view_info.num_caches)); + memcpy(ptr, &wccp2_cache_view_info.num_caches, sizeof(wccp2_cache_view_info.num_caches)); ptr += sizeof(wccp2_cache_view_info.num_caches); @@ -903,7 +901,7 @@ wccp2Init(void) wccp2_capability_info_header.capability_info_length = htons(3 * sizeof(wccp2_capability_element)); - xmemcpy(ptr, &wccp2_capability_info_header, sizeof(wccp2_capability_info_header)); + memcpy(ptr, &wccp2_capability_info_header, sizeof(wccp2_capability_info_header)); ptr += sizeof(wccp2_capability_info_header); @@ -918,7 +916,7 @@ wccp2Init(void) wccp2_capability_element.capability_value = htonl(Config.Wccp2.forwarding_method); - xmemcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); + memcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); ptr += sizeof(wccp2_capability_element); @@ -933,7 +931,7 @@ wccp2Init(void) wccp2_capability_element.capability_value = htonl(Config.Wccp2.assignment_method); - xmemcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); + memcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); ptr += sizeof(wccp2_capability_element); @@ -948,7 +946,7 @@ wccp2Init(void) wccp2_capability_element.capability_value = htonl(Config.Wccp2.return_method); - xmemcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); + memcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); ptr += sizeof(wccp2_capability_element); @@ -1766,7 +1764,7 @@ wccp2AssignBuckets(void *voidnotused) offset += sizeof(struct assignment_key_t); /* Number of routers */ - xmemcpy(&wccp_packet[offset], &service_list_ptr->num_routers, sizeof(service_list_ptr->num_routers)); + memcpy(&wccp_packet[offset], &service_list_ptr->num_routers, sizeof(service_list_ptr->num_routers)); offset += sizeof(service_list_ptr->num_routers); @@ -1795,7 +1793,7 @@ wccp2AssignBuckets(void *voidnotused) case WCCP2_ASSIGNMENT_METHOD_HASH: /* Number of caches */ - xmemcpy(&wccp_packet[offset], &router_list_ptr->num_caches, sizeof(router_list_ptr->num_caches)); + memcpy(&wccp_packet[offset], &router_list_ptr->num_caches, sizeof(router_list_ptr->num_caches)); offset += sizeof(router_list_ptr->num_caches); if (num_caches) { @@ -1806,7 +1804,7 @@ wccp2AssignBuckets(void *voidnotused) cache_address = (struct in_addr *) &wccp_packet[offset]; - xmemcpy(cache_address, &cache_list_ptr->cache_ip, sizeof(struct in_addr)); + memcpy(cache_address, &cache_list_ptr->cache_ip, sizeof(struct in_addr)); total_weight += cache_list_ptr->weight << 12; weight[cache] = cache_list_ptr->weight << 12; @@ -1865,7 +1863,7 @@ wccp2AssignBuckets(void *voidnotused) case WCCP2_ASSIGNMENT_METHOD_MASK: num_maskval = htonl(1); - xmemcpy(&wccp_packet[offset], &num_maskval, sizeof(int)); + memcpy(&wccp_packet[offset], &num_maskval, sizeof(int)); offset += sizeof(int); mask_element = (struct wccp2_mask_element_t *) &wccp_packet[offset]; diff --git a/test-suite/pconn-banger.c b/test-suite/pconn-banger.c index 6f0b135c37..6bb8ebf997 100644 --- a/test-suite/pconn-banger.c +++ b/test-suite/pconn-banger.c @@ -312,7 +312,7 @@ handle_read(char *inbuf, int len) return -1; } total_bytes_read += len; - xmemcpy(buf, inbuf, len); + memcpy(buf, inbuf, len); if (len == 0) { fprintf(stderr, "WARNING: %s, server closed socket after %d+%d bytes\n", r->url, r->hdr_offset, r->bytes_read); /* XXX, If no data was received and it isn't the first request on this @@ -331,12 +331,12 @@ handle_read(char *inbuf, int len) /* Build headers */ if (r->hdr_length == 0) { hlen = min(len, REPLY_HDR_SZ - r->hdr_offset - 1); - xmemcpy(r->reply_hdrs + r->hdr_offset, buf, hlen); + memcpy(r->reply_hdrs + r->hdr_offset, buf, hlen); r->hdr_offset += hlen; r->reply_hdrs[r->hdr_offset] = '\0'; len -= hlen; /* Save any remaining read data */ - xmemmove(buf, buf + hlen, len); + memmove(buf, buf + hlen, len); } /* Process headers */ if (r->hdr_length == 0 && (end = mime_headers_end(r->reply_hdrs)) != NULL) { @@ -352,8 +352,8 @@ handle_read(char *inbuf, int len) blen = r->hdr_offset - r->hdr_length; assert(blen >= 0); if (blen > 0) { - xmemmove(buf + blen, buf, len); - xmemcpy(buf, r->reply_hdrs + r->hdr_length, blen); + memmove(buf + blen, buf, len); + memcpy(buf, r->reply_hdrs + r->hdr_length, blen); len += blen; } r->reply_hdrs[r->hdr_length] = '\0'; /* Null terminate headers */ @@ -398,7 +398,7 @@ handle_read(char *inbuf, int len) } else if (r->content_length > -1) { assert(r->bytes_read < r->content_length); } - xmemmove(buf, buf + bytes_used, len); + memmove(buf, buf + bytes_used, len); } } return 0;