/* 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 */
osdetect.h \
psignal.h \
stdvarargs.h \
+ strnstr.cc \
strsep.h \
strtoll.h \
tempnam.h \
valgrind.h \
xalloc.cc \
xalloc.h \
+ xis.h \
xstrerror.cc \
xstrerror.h \
xstring.cc \
#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 */
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 */
-#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.
*/
#include "config.h"
-#include "strnstr.h"
#if !HAVE_STRNSTR
#include <string.h>
#endif
-/*
+/**
* Find the first occurrence of find in s, where the search is limited to the
* first slen characters of s.
*/
}
#endif /* !HAVE_STRNSTR */
-#endif /* _SQUID_COMPAT_STRNSTR_C_ */
+#endif /* _SQUID_COMPAT_STRNSTR_CC_ */
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 */
--- /dev/null
+#ifndef _SQUID_COMPAT_XIS_H
+#define _SQUID_COMPAT_XIS_H
+
+#if HAVE_CTYPE_H
+#include <ctype.h>
+#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 */
* 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);
}
#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 <ctype.h>
-#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
#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
*/
/* 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 */
+++ /dev/null
-#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*/
rfc3596.c \
$(SNPRINTFSOURCE) \
Splay.cc \
- strnstr.cc \
stub_memaccount.c \
util.c \
xusleep.c \
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);
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);
}
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);
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);
}
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);
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);
}
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);
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 */
/* 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);
}
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));
#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. */
#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);
}
/* 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",
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;
}
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;
"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 "
void
CpuAffinitySet::set(const cpu_set_t &aCpuSet)
{
- xmemcpy(&theCpuSet, &aCpuSet, sizeof(theCpuSet));
+ memcpy(&theCpuSet, &aCpuSet, sizeof(theCpuSet));
}
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<char *>(aRequest->buf));
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));
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));
PROF_start(MemBuf_consume);
if (shiftSize > 0) {
if (shiftSize < cSize)
- xmemmove(buf, buf + shiftSize, cSize - shiftSize);
+ memmove(buf, buf + shiftSize, cSize - shiftSize);
size -= shiftSize;
grow(size + sz + 1);
assert(size + sz <= capacity); /* paranoid */
-
- xmemcpy(space(), newContent, sz);
-
+ memcpy(space(), newContent, sz);
appended(sz);
}
PROF_stop(MemBuf_append);
SquidMD5Init(&M);
SquidMD5Update(&M, (unsigned char *) url, strlen(url));
SquidMD5Final(digest, &M);
- xmemcpy(&ck, digest, sizeof(ck));
+ memcpy(&ck, digest, sizeof(ck));
return ck;
}
(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));
}
/*
result->length = len;
result->value = xmalloc(len);
- xmemcpy(result->value, value, len);
+ memcpy(result->value, value, len);
return result;
}
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))
void
StoreMetaUnpacker::getLength()
{
- xmemcpy(&length, &buf[position], sizeof(int));
+ memcpy(&length, &buf[position], sizeof(int));
position += sizeof(int);
}
assert(this && str);
allocBuffer(len + 1);
len_ = len;
- xmemcpy(buf_, str, len);
+ memcpy(buf_, str, len);
buf_[len] = '\0';
PROF_stop(StringAllocAndFill);
}
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';
* 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
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);
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;
}
*/
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
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;
}
}
char *current_buf = in.addressToReadInto();
if (buf != current_buf)
- xmemmove(current_buf, buf, size);
+ memmove(current_buf, buf, size);
in.notYetUsed += size;
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;
}
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 */
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;
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;
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);
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);
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;
&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) {
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;
}
if (!count)
return;
- xmemmove (elements, &elements[count], (elementcount - count) * sizeof (ESIElement::Pointer));
+ memmove(elements, &elements[count], (elementcount - count) * sizeof (ESIElement::Pointer));
elementcount -= count;
}
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;
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;
}
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;
}
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 */
}
cstate->readbuffer = (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;
}
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 */
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,
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 */
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)
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);
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 */
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,
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;
}
};
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;
}
};
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;
}
};
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:
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:
/* 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 */
len = TEMP_BUF_SIZE - gopherState->len;
}
- xmemcpy(gopherState->buf + gopherState->len, inbuf, len);
+ memcpy(gopherState->buf + gopherState->len, inbuf, len);
gopherState->len += len;
return;
}
}
if (len > (pos - inbuf)) {
- xmemcpy(gopherState->buf, pos, len - (pos - inbuf));
+ memcpy(gopherState->buf, pos, len - (pos - inbuf));
gopherState->len = len - (pos - inbuf);
}
copy_sz += 2;
if (buflen < copy_sz)
return -1;
- xmemcpy(buf, &auth, copy_sz);
+ memcpy(buf, &auth, copy_sz);
return copy_sz;
}
length = htons((uint16_t) len);
- xmemcpy(buf + off, &length, 2);
+ memcpy(buf + off, &length, 2);
off += 2;
return -1;
if (len)
- xmemcpy(buf + off, s, len);
+ memcpy(buf + off, s, len);
off += len;
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;
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));
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);
else
hdr.minor = 1;
- xmemcpy(buf, &hdr, hdr_sz);
+ memcpy(buf, &hdr, hdr_sz);
debugs(31, 3, "htcpBuildPacket: size " << off);
}
htcpHexdump("htcpHandle", buf, sz);
- xmemcpy(&htcpHdr, buf, sizeof(htcpHeader));
+ memcpy(&htcpHdr, buf, sizeof(htcpHeader));
htcpHdr.length = ntohs(htcpHdr.length);
if (htcpHdr.minor == 0)
}
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;
/* 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... */
if (len > MAX_PAYLOAD)
len = MAX_PAYLOAD;
- xmemcpy(echo->payload, payload, len);
+ memcpy(echo->payload, payload, len);
icmp_pktsize += len;
}
if (len > MAX_PAYLOAD)
len = MAX_PAYLOAD;
- xmemcpy(echo->payload, payload, len);
+ memcpy(echo->payload, payload, len);
icmp6_pktsize += len;
}
return -1;
}
- xmemcpy(&wpi, buf, sizeof(wpi));
+ memcpy(&wpi, buf, sizeof(wpi));
write(1, "OK\n", 3);
x = read(0, buf, sizeof(PS));
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);
pecho.psize = len;
if (len > 0)
- xmemcpy(pecho.payload, payload, len);
+ memcpy(pecho.payload, payload, len);
slen = sizeof(pingerEchoData) - PINGER_PAYLOAD_SZ + pecho.psize;
n = (netdbEntry *)memAllocate(MEM_NETDBENTRY);
- xmemcpy(n, &N, sizeof(netdbEntry));
+ memcpy(n, &N, sizeof(netdbEntry));
netdbHashInsert(n, addr);
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;
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);
j = htonl((int) (n->rtt * 1000));
- xmemcpy(&buf[i], &j, sizeof(int));
+ memcpy(&buf[i], &j, sizeof(int));
i += sizeof(int);
j = htonl((int) (n->hops * 1000));
- xmemcpy(&buf[i], &j, sizeof(int));
+ memcpy(&buf[i], &j, sizeof(int));
i += sizeof(int);
return;
}
- xmemcpy(this, buf, sizeof(icp_common_t));
+ memcpy(this, buf, sizeof(icp_common_t));
/*
* Convert network order sensitive fields
*/
if (opcode == ICP_QUERY)
urloffset += sizeof(uint32_t);
- xmemcpy(urloffset, url, strlen(url));
+ memcpy(urloffset, url, strlen(url));
return (icp_common_t *)buf;
}
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;
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;
}
}
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;
}
}
cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fdCount);
int *fdStore = reinterpret_cast<int*>(CMSG_DATA(cmsg));
- xmemcpy(fdStore, &fd, fdCount * sizeof(int));
+ memcpy(fdStore, &fd, fdCount * sizeof(int));
msg_controllen = cmsg->cmsg_len;
}
const int fdCount = 1;
const int *fdStore = reinterpret_cast<const int*>(CMSG_DATA(cmsg));
int fd = -1;
- xmemcpy(&fd, fdStore, fdCount * sizeof(int));
+ memcpy(&fd, fdStore, fdCount * sizeof(int));
return fd;
}
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]);
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] );
b = static_cast<logfile_buffer_t*>(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;
return;
}
/* buffer it */
- xmemcpy(ll->buf + ll->offset, buf, len);
+ memcpy(ll->buf + ll->offset, buf, len);
ll->offset += len;
return;
}
/* buffer it */
- xmemcpy(ll->buf + ll->offset, buf, len);
+ memcpy(ll->buf + ll->offset, buf, len);
ll->offset += len;
return;
}
/* buffer it */
- xmemcpy(ll->buf + ll->offset, buf, len);
+ memcpy(ll->buf + ll->offset, buf, len);
ll->offset += len;
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);
*/
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;
* 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! */
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);
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");
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;
}
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 {
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];
}
}
} 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 {
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);
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
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 ;
}
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++;
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++;
}
{
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 */
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;
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;
}
*/
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);
StorePointer *tmp;
swap->n_allocated <<= 1;
tmp = static_cast<StorePointer *>(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;
}
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;
}
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;
}
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;
}
* 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); */
if ((t = strrchr(Host, '@'))) {
t++;
- xmemmove(Host, t, strlen(t) + 1);
+ memmove(Host, t, strlen(t) + 1);
}
}
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);
}
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));
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;
}
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;
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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) {
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;
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];
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
/* 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) {
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 */
} 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;