Merge ssh://ssh.dcc.fc.up.pt:31064/home/vsc/yap

This commit is contained in:
Vitor Santos Costa 2018-06-30 16:31:40 +01:00
commit 53de04c38f
89 changed files with 633 additions and 624 deletions

View File

@ -221,7 +221,7 @@ Atom Yap_LookupAtomWithLength(const char *atom,
ptr = Yap_AllocCodeSpace(len0 + 1); ptr = Yap_AllocCodeSpace(len0 + 1);
if (!ptr) if (!ptr)
return NIL; return NIL;
memcpy(ptr, atom, len0); memmove(ptr, atom, len0);
ptr[len0] = '\0'; ptr[len0] = '\0';
at = LookupAtom(ptr); at = LookupAtom(ptr);
Yap_FreeCodeSpace(ptr); Yap_FreeCodeSpace(ptr);
@ -1010,7 +1010,7 @@ Atom Yap_LookupAtomWithLength(const char *atom,
if (IsApplTerm(t0)) { if (IsApplTerm(t0)) {
Yap_FreeCodeSpace((char *)RepAppl(t0)); Yap_FreeCodeSpace((char *)RepAppl(t0));
} }
memcpy((void *)pt, (void *)ap, sz); memmove((void *)pt, (void *)ap, sz);
p->ValueOfVE = AbsAppl(pt); p->ValueOfVE = AbsAppl(pt);
#endif #endif
} else if (IsStringTerm(v)) { } else if (IsStringTerm(v)) {
@ -1025,7 +1025,7 @@ Atom Yap_LookupAtomWithLength(const char *atom,
if (IsApplTerm(t0)) { if (IsApplTerm(t0)) {
Yap_FreeCodeSpace((char *)RepAppl(t0)); Yap_FreeCodeSpace((char *)RepAppl(t0));
} }
memcpy((void *)pt, (void *)ap, sz); memmove((void *)pt, (void *)ap, sz);
p->ValueOfVE = AbsAppl(pt); p->ValueOfVE = AbsAppl(pt);
} else { } else {
if (IsApplTerm(t0)) { if (IsApplTerm(t0)) {

View File

@ -216,7 +216,7 @@ Atom Yap_LookupAtomWithLength(const char *atom,
ptr = Yap_AllocCodeSpace(len0 + 1); ptr = Yap_AllocCodeSpace(len0 + 1);
if (!ptr) if (!ptr)
return NIL; return NIL;
memcpy(ptr, atom, len0); memmove(ptr, atom, len0);
ptr[len0] = '\0'; ptr[len0] = '\0';
at = LookupAtom(ptr); at = LookupAtom(ptr);
Yap_FreeCodeSpace(ptr); Yap_FreeCodeSpace(ptr);
@ -1004,7 +1004,7 @@ void Yap_PutValue(Atom a, Term v) {
if (IsApplTerm(t0)) { if (IsApplTerm(t0)) {
Yap_FreeCodeSpace((char *)RepAppl(t0)); Yap_FreeCodeSpace((char *)RepAppl(t0));
} }
memcpy((void *)pt, (void *)ap, sz); memmove((void *)pt, (void *)ap, sz);
p->ValueOfVE = AbsAppl(pt); p->ValueOfVE = AbsAppl(pt);
#endif #endif
} else if (IsStringTerm(v)) { } else if (IsStringTerm(v)) {
@ -1019,7 +1019,7 @@ void Yap_PutValue(Atom a, Term v) {
if (IsApplTerm(t0)) { if (IsApplTerm(t0)) {
Yap_FreeCodeSpace((char *)RepAppl(t0)); Yap_FreeCodeSpace((char *)RepAppl(t0));
} }
memcpy((void *)pt, (void *)ap, sz); memmove((void *)pt, (void *)ap, sz);
p->ValueOfVE = AbsAppl(pt); p->ValueOfVE = AbsAppl(pt);
} else { } else {
if (IsApplTerm(t0)) { if (IsApplTerm(t0)) {

View File

@ -1329,7 +1329,7 @@ XX realloc(MALLOC_T ptr, size_t size) {
MALLOC_T new = malloc(size); MALLOC_T new = malloc(size);
if (ptr) if (ptr)
memcpy(new, ptr, size); memmove(new, ptr, size);
free(ptr); free(ptr);
return (new); return (new);
} }

View File

@ -2070,7 +2070,7 @@ static Int atom_split(USES_REGS1) {
} }
size_t b_mid = skip_utf8(s0, u_mid) - s0; size_t b_mid = skip_utf8(s0, u_mid) - s0;
s1 = s10 = Malloc(b_mid + 1); s1 = s10 = Malloc(b_mid + 1);
memcpy(s1, s, b_mid); memmove(s1, s, b_mid);
s1[b_mid] = '\0'; s1[b_mid] = '\0';
to1 = MkAtomTerm(Yap_ULookupAtom(s10)); to1 = MkAtomTerm(Yap_ULookupAtom(s10));
to2 = MkAtomTerm(Yap_ULookupAtom(s0 + b_mid)); to2 = MkAtomTerm(Yap_ULookupAtom(s0 + b_mid));

View File

@ -48,7 +48,7 @@ char *Yap_blob_to_string(AtomEntry *ref, const char *s0, size_t sz) {
size_t sz0 = strlcpy(s, (char *)RepAtom(AtomSWIStream)->StrOfAE, sz); size_t sz0 = strlcpy(s, (char *)RepAtom(AtomSWIStream)->StrOfAE, sz);
#else #else
size_t sz0; size_t sz0;
char *f = (char *)memcpy(s, (char *)RepAtom(AtomSWIStream)->StrOfAE, sz); char *f = (char *)memmove(s, (char *)RepAtom(AtomSWIStream)->StrOfAE, sz);
f[0] = '\0'; f[0] = '\0';
sz0 = f - s; sz0 = f - s;
#endif #endif
@ -156,7 +156,7 @@ AtomEntry *Yap_lookupBlob(void *blob, size_t len, void *type0, int *new) {
ae->PropsOfAE = AbsBlobProp(b); ae->PropsOfAE = AbsBlobProp(b);
ae->NextOfAE = AbsAtom(Blobs); ae->NextOfAE = AbsAtom(Blobs);
ae->rep.blob->length = len; ae->rep.blob->length = len;
memcpy(ae->rep.blob->data, blob, len); memmove(ae->rep.blob->data, blob, len);
Blobs = ae; Blobs = ae;
if (NOfBlobs > NOfBlobsMax) { if (NOfBlobs > NOfBlobsMax) {
Yap_signal(YAP_CDOVF_SIGNAL); Yap_signal(YAP_CDOVF_SIGNAL);

View File

@ -1898,7 +1898,7 @@ X_API YAP_opaque_tag_t YAP_NewOpaqueType(struct YAP_opaque_handler_struct *f) {
return -1; return -1;
} }
i = GLOBAL_OpaqueHandlersCount++; i = GLOBAL_OpaqueHandlersCount++;
memcpy(GLOBAL_OpaqueHandlers + i, f, sizeof(YAP_opaque_handler_t)); memmove(GLOBAL_OpaqueHandlers + i, f, sizeof(YAP_opaque_handler_t));
return i; return i;
} }
@ -2176,7 +2176,8 @@ X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
if (osnop >= 0) if (osnop >= 0)
Yap_AddAlias(AtomLoopStream, *osnop); Yap_AddAlias(AtomLoopStream, *osnop);
Yap_end_consult(); Yap_end_consult();
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s(%d), %d", full, *osnop, sno); __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s:%s(%d), %d",
CurrentModule == 0? "prolog": RepAtom(AtomOfTerm(CurrentModule))->StrOfAE, full, *osnop, sno);
// LOCAL_CurSlot); // LOCAL_CurSlot);
pop_text_stack(lvl); pop_text_stack(lvl);
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
@ -3104,7 +3105,7 @@ X_API Int YAP_AtomToInt(YAP_Atom At) {
"No more room for translations"); "No more room for translations");
return -1; return -1;
} }
memcpy(nt, ot, sizeof(atom_t) * MaxAtomTranslations); memmove(nt, ot, sizeof(atom_t) * MaxAtomTranslations);
TR_Atoms = nt; TR_Atoms = nt;
free(ot); free(ot);
MaxAtomTranslations *= 2; MaxAtomTranslations *= 2;
@ -3132,7 +3133,7 @@ X_API Int YAP_FunctorToInt(YAP_Functor f) {
"No more room for translations"); "No more room for translations");
return -1; return -1;
} }
memcpy(nt, ot, sizeof(functor_t) * MaxFunctorTranslations); memmove(nt, ot, sizeof(functor_t) * MaxFunctorTranslations);
TR_Functors = nt; TR_Functors = nt;
free(ot); free(ot);
MaxFunctorTranslations *= 2; MaxFunctorTranslations *= 2;

View File

@ -301,7 +301,7 @@ void Yap_BuildMegaClause(PredEntry *ap) {
mcl->ClLine = cl->usc.ClLine; mcl->ClLine = cl->usc.ClLine;
ptr = mcl->ClCode; ptr = mcl->ClCode;
while (TRUE) { while (TRUE) {
memcpy((void *)ptr, (void *)cl->ClCode, sz); memmove((void *)ptr, (void *)cl->ClCode, sz);
if (has_blobs) { if (has_blobs) {
LOCAL_ClDiff = (char *)(ptr) - (char *)cl->ClCode; LOCAL_ClDiff = (char *)(ptr) - (char *)cl->ClCode;
restore_opcodes(ptr, NULL PASS_REGS); restore_opcodes(ptr, NULL PASS_REGS);
@ -380,7 +380,7 @@ static void split_megaclause(PredEntry *ap) {
new->ClSize = mcl->ClItemSize; new->ClSize = mcl->ClItemSize;
new->usc.ClLine = Yap_source_line_no(); new->usc.ClLine = Yap_source_line_no();
new->ClNext = NULL; new->ClNext = NULL;
memcpy((void *)new->ClCode, (void *)ptr, mcl->ClItemSize); memmove((void *)new->ClCode, (void *)ptr, mcl->ClItemSize);
if (prev) { if (prev) {
prev->ClNext = new; prev->ClNext = new;
} else { } else {
@ -1386,7 +1386,7 @@ static void expand_consult(void) {
} }
new_cs = new_cl + InitialConsultCapacity; new_cs = new_cl + InitialConsultCapacity;
/* start copying */ /* start copying */
memcpy((void *)new_cs, (void *)LOCAL_ConsultLow, memmove((void *)new_cs, (void *)LOCAL_ConsultLow,
OldConsultCapacity * sizeof(consult_obj)); OldConsultCapacity * sizeof(consult_obj));
/* copying done, release old space */ /* copying done, release old space */
Yap_FreeCodeSpace((char *)LOCAL_ConsultLow); Yap_FreeCodeSpace((char *)LOCAL_ConsultLow);

View File

@ -719,7 +719,7 @@ restart:
dest = Yap_emit_extra_size(blob_op, sz / CellSize, sz, &cglobs->cint); dest = Yap_emit_extra_size(blob_op, sz / CellSize, sz, &cglobs->cint);
/* copy the bignum */ /* copy the bignum */
memcpy(dest, src, sz); memmove(dest, src, sz);
/* note that we don't need to copy size info, unless we wanted /* note that we don't need to copy size info, unless we wanted
to garbage collect clauses ;-) */ to garbage collect clauses ;-) */
cglobs->cint.icpc = cglobs->cint.cpc; cglobs->cint.icpc = cglobs->cint.cpc;
@ -758,7 +758,7 @@ restart:
dest = Yap_emit_extra_size(blob_op, sz / CellSize, sz, &cglobs->cint); dest = Yap_emit_extra_size(blob_op, sz / CellSize, sz, &cglobs->cint);
/* copy the bignum */ /* copy the bignum */
memcpy(dest, src, sz); memmove(dest, src, sz);
/* note that we don't need to copy size info, unless we wanted /* note that we don't need to copy size info, unless we wanted
to garbage collect clauses ;-) */ to garbage collect clauses ;-) */
cglobs->cint.icpc = cglobs->cint.cpc; cglobs->cint.icpc = cglobs->cint.cpc;

View File

@ -642,7 +642,7 @@ static CELL *copy_double(CELL *st, CELL *pt) {
static CELL *copy_string(CELL *st, CELL *pt) { static CELL *copy_string(CELL *st, CELL *pt) {
UInt sz = pt[1] + 3; UInt sz = pt[1] + 3;
/* first thing, store a link to the list before we move on */ /* first thing, store a link to the list before we move on */
memcpy(st, pt, sizeof(CELL) * sz); memmove(st, pt, sizeof(CELL) * sz);
/* now reserve space */ /* now reserve space */
return st + sz; return st + sz;
} }
@ -656,7 +656,7 @@ static CELL *copy_big_int(CELL *st, CELL *pt) {
st[0] = (CELL)FunctorBigInt; st[0] = (CELL)FunctorBigInt;
st[1] = pt[1]; st[1] = pt[1];
/* then the actual number */ /* then the actual number */
memcpy((void *)(st + 2), (void *)(pt + 2), sz); memmove((void *)(st + 2), (void *)(pt + 2), sz);
st = st + 2 + sz / CellSize; st = st + 2 + sz / CellSize;
/* then the tail for gc */ /* then the tail for gc */
st[0] = EndSpecials; st[0] = EndSpecials;
@ -968,7 +968,7 @@ loop:
if (HR + sz >= ASP) { if (HR + sz >= ASP) {
goto error2; goto error2;
} }
memcpy((void *)HR, (void *)(to_visit_base), sz * sizeof(CELL *)); memmove((void *)HR, (void *)(to_visit_base), sz * sizeof(CELL *));
to_visit_base = (CELL **)HR; to_visit_base = (CELL **)HR;
to_visit = to_visit_base + sz; to_visit = to_visit_base + sz;
} }
@ -1684,7 +1684,7 @@ static DBRef CreateDBStruct(Term Tm, DBProp p, int InFlag, int *pstat,
nar = ppt->Contents + Unsigned(NOfCells); nar = ppt->Contents + Unsigned(NOfCells);
} }
woar = (link_entry *)nar; woar = (link_entry *)nar;
memcpy((void *)woar, (const void *)dbg->LinkAr, memmove((void *)woar, (const void *)dbg->LinkAr,
(size_t)(NOfLinks * sizeof(link_entry))); (size_t)(NOfLinks * sizeof(link_entry)));
woar += NOfLinks; woar += NOfLinks;
#ifdef ALIGN_LONGS #ifdef ALIGN_LONGS

View File

@ -1978,7 +1978,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
assert(ncopies >= 3); assert(ncopies >= 3);
if (ncopies > 9) if (ncopies > 9)
memcpy(d, s, copysize); memmove(d, s, copysize);
else { else {
*(d+0) = *(s+0); *(d+0) = *(s+0);
@ -2077,7 +2077,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
/* Must alloc, copy, free. */ /* Must alloc, copy, free. */
newmem = mALLOc(nb - MALLOC_ALIGN_MASK); newmem = mALLOc(nb - MALLOC_ALIGN_MASK);
if (newmem != 0) { if (newmem != 0) {
memcpy(newmem, oldmem, oldsize - 2*SIZE_SZ); memmove(newmem, oldmem, oldsize - 2*SIZE_SZ);
fREe(oldmem); fREe(oldmem);
} }
} }

View File

@ -49,7 +49,7 @@
const char *s = IsAtomTerm(t) ? RepAtom(AtomOfTerm(t))->StrOfAE \ const char *s = IsAtomTerm(t) ? RepAtom(AtomOfTerm(t))->StrOfAE \
: IsStringTerm(t) ? StringOfTerm(t) : NULL; \ : IsStringTerm(t) ? StringOfTerm(t) : NULL; \
if (s) { \ if (s) { \
char *tmp = malloc(strlen(s) + 1); \ char *tmp = calloc(1,strlen(s) + 1); \
strcpy(tmp, s); \ strcpy(tmp, s); \
i->k = tmp; \ i->k = tmp; \
} \ } \
@ -148,10 +148,10 @@ static void printErr(yap_error_descriptor_t *i) {
return; return;
} }
print_key_i("errorNo", i->errorNo); print_key_i("errorNo", i->errorNo);
print_key_i("errorClass", i->errorClass); print_key_i("errorClass", (i->errorClass = Yap_errorClass(i->errorNo)));
print_key_s("errorAsText", i->errorAsText); print_key_s("errorAsText", (i->errorAsText=Yap_errorName(i->errorNo) ) );
print_key_s("errorGoal", i->errorGoal); print_key_s("errorGoal", i->errorGoal);
print_key_s("classAsText", i->classAsText); print_key_s("classAsText", (i->classAsText=Yap_errorClassName(i->errorClass)));
print_key_i("errorLine", i->errorLine); print_key_i("errorLine", i->errorLine);
print_key_s("errorFunction", i->errorFunction); print_key_s("errorFunction", i->errorFunction);
print_key_s("errorFile", i->errorFile); print_key_s("errorFile", i->errorFile);
@ -589,7 +589,7 @@ yap_error_descriptor_t *Yap_popErrorContext(bool mdnew, bool pass) {
LOCAL_ActiveError = e->top_error; LOCAL_ActiveError = e->top_error;
if (e->errorNo) { if (e->errorNo) {
if (!LOCAL_ActiveError->errorNo && pass) { if (!LOCAL_ActiveError->errorNo && pass) {
memcpy(LOCAL_ActiveError, e, sizeof(*LOCAL_ActiveError)); memmove(LOCAL_ActiveError, e, sizeof(*LOCAL_ActiveError));
} else { } else {
return e; return e;
} }
@ -941,6 +941,7 @@ typedef struct c_error_info {
; ;
#include <YapErrors.h> #include <YapErrors.h>
#include <iopreds.h>
yap_error_class_number Yap_errorClass(yap_error_number e) { yap_error_class_number Yap_errorClass(yap_error_number e) {
return c_error_list[e].class; return c_error_list[e].class;
@ -956,8 +957,8 @@ yap_error_descriptor_t *Yap_GetException(yap_error_descriptor_t *i) {
CACHE_REGS CACHE_REGS
if (i->errorNo != YAP_NO_ERROR) { if (i->errorNo != YAP_NO_ERROR) {
yap_error_descriptor_t *t = LOCAL_ActiveError, yap_error_descriptor_t *t = LOCAL_ActiveError,
*nt = malloc(sizeof(yap_error_descriptor_t)); *nt = calloc(1,sizeof(yap_error_descriptor_t));
memcpy(nt, t, sizeof(yap_error_descriptor_t)); memmove(nt, t, sizeof(yap_error_descriptor_t));
return nt; return nt;
} }
return 0; return 0;
@ -1002,8 +1003,13 @@ static Int read_exception(USES_REGS1) {
} }
static Int print_exception(USES_REGS1) { static Int print_exception(USES_REGS1) {
yap_error_descriptor_t *t = AddressOfTerm(Deref(ARG1)); Term t1 = Deref(ARG1);
printErr(t); if (IsAddressTerm(t1)) {
yap_error_descriptor_t *t = AddressOfTerm(t1);
printErr(t);
} else {
return Yap_WriteTerm(LOCAL_c_error_stream,t1,TermNil PASS_REGS);
}
// Yap_DebugPlWriteln(rc); // Yap_DebugPlWriteln(rc);
return true; return true;
} }

View File

@ -253,7 +253,7 @@ IntervalUDIRefitIndex(struct index_t **ip, UInt b[] USES_REGS)
qsort(s0+1, (size_t)*s0, sizeof(BITS32), compar); qsort(s0+1, (size_t)*s0, sizeof(BITS32), compar);
it->links[offset0] = s0-sorted0; it->links[offset0] = s0-sorted0;
if (it->udi_free_args) { if (it->udi_free_args) {
memcpy(sorted, s0+1, sizeof(BITS32)*(*s0)); memmove(sorted, s0+1, sizeof(BITS32)*(*s0));
qsort(sorted, (size_t)*s0, sizeof(BITS32), compar2); qsort(sorted, (size_t)*s0, sizeof(BITS32), compar2);
sorted += *s0; sorted += *s0;
} }

View File

@ -56,7 +56,7 @@
CPredicate f = PREG->y_u.Osbpp.p->cs.f_code; CPredicate f = PREG->y_u.Osbpp.p->cs.f_code;
PREG = NEXTOP(PREG, Osbpp); PREG = NEXTOP(PREG, Osbpp);
saveregs(); saveregs();
d0 = (f)(PASS_REGS1); d0 = f(PASS_REGS1);
setregs(); setregs();
#ifdef SHADOW_S #ifdef SHADOW_S
SREG = Yap_REGS.S_; SREG = Yap_REGS.S_;

View File

@ -475,7 +475,7 @@ loop:
goto overflow; goto overflow;
} }
*ptf++ = AbsAppl(HR); *ptf++ = AbsAppl(HR);
memcpy(HR, ap2, sizeof(CELL) * (3 + ap2[1])); memmove(HR, ap2, sizeof(CELL) * (3 + ap2[1]));
HR += ap2[1] + 3; HR += ap2[1] + 3;
break; break;
default: { default: {
@ -756,7 +756,7 @@ restart:
res = -1; res = -1;
goto error_handler; goto error_handler;
} }
memcpy(HR, ap, sizeof(CELL) * (3 + ap[1])); memmove(HR, ap, sizeof(CELL) * (3 + ap[1]));
HR += ap[1] + 3; HR += ap[1] + 3;
break; break;
default: { default: {

View File

@ -205,13 +205,13 @@ CopyLocalAndTrail( USES_REGS1 )
static void static void
IncrementalCopyStacksFromWorker( USES_REGS1 ) IncrementalCopyStacksFromWorker( USES_REGS1 )
{ {
memcpy((void *) PtoGloAdjust((CELL *)LOCAL_start_global_copy), memmove((void *) PtoGloAdjust((CELL *)LOCAL_start_global_copy),
(void *) (LOCAL_start_global_copy), (void *) (LOCAL_start_global_copy),
(size_t) (LOCAL_end_global_copy - LOCAL_start_global_copy)); (size_t) (LOCAL_end_global_copy - LOCAL_start_global_copy));
memcpy((void *) PtoLocAdjust((CELL *)LOCAL_start_local_copy), memmove((void *) PtoLocAdjust((CELL *)LOCAL_start_local_copy),
(void *) LOCAL_start_local_copy, (void *) LOCAL_start_local_copy,
(size_t) (LOCAL_end_local_copy - LOCAL_start_local_copy)); (size_t) (LOCAL_end_local_copy - LOCAL_start_local_copy));
memcpy((void *) PtoTRAdjust((tr_fr_ptr)LOCAL_start_trail_copy), memmove((void *) PtoTRAdjust((tr_fr_ptr)LOCAL_start_trail_copy),
(void *) (LOCAL_start_trail_copy), (void *) (LOCAL_start_trail_copy),
(size_t) (LOCAL_end_trail_copy - LOCAL_start_trail_copy)); (size_t) (LOCAL_end_trail_copy - LOCAL_start_trail_copy));
} }

View File

@ -825,7 +825,7 @@ static inline int smaller_or_eq(Term t1, Term t2) {
} }
static inline void clcpy(ClauseDef *d, ClauseDef *s) { static inline void clcpy(ClauseDef *d, ClauseDef *s) {
memcpy((void *)d, (void *)s, sizeof(ClauseDef)); memmove((void *)d, (void *)s, sizeof(ClauseDef));
} }
static void insort(ClauseDef base[], CELL *p, CELL *q, int my_p) { static void insort(ClauseDef base[], CELL *p, CELL *q, int my_p) {
@ -2670,7 +2670,7 @@ static ClauseDef *copy_clauses(ClauseDef *max0, ClauseDef *min0, CELL *top,
save_machine_regs(); save_machine_regs();
siglongjmp(cint->CompilerBotch, 4); siglongjmp(cint->CompilerBotch, 4);
} }
memcpy((void *)top, (void *)min0, sz); memmove((void *)top, (void *)min0, sz);
return (ClauseDef *)top; return (ClauseDef *)top;
} }

View File

@ -301,7 +301,7 @@ bool Yap_dup_op(OpEntry *op, ModEntry *she) {
OpEntry *info = (OpEntry *)Yap_AllocAtomSpace(sizeof(OpEntry)); OpEntry *info = (OpEntry *)Yap_AllocAtomSpace(sizeof(OpEntry));
if (!info) if (!info)
return false; return false;
memcpy(info, op, sizeof(OpEntry)); memmove(info, op, sizeof(OpEntry));
info->NextForME = she->OpForME; info->NextForME = she->OpForME;
she->OpForME = info; she->OpForME = info;
info->OpModule = MkAtomTerm(she->AtomOfME); info->OpModule = MkAtomTerm(she->AtomOfME);
@ -1162,7 +1162,7 @@ void Yap_init_yapor_workers(void) {
worker_id = proc; worker_id = proc;
Yap_remap_yapor_memory(); Yap_remap_yapor_memory();
LOCAL = REMOTE(worker_id); LOCAL = REMOTE(worker_id);
memcpy(REMOTE(worker_id), REMOTE(0), sizeof(struct worker_local)); memmove(REMOTE(worker_id), REMOTE(0), sizeof(struct worker_local));
InitWorker(worker_id); InitWorker(worker_id);
break; break;
} else } else

View File

@ -199,7 +199,7 @@ const void *MallocExportAsRO(const void *pt USES_REGS) {
return NULL; return NULL;
size_t sz = o->sz; size_t sz = o->sz;
release_block(o); release_block(o);
memcpy((void *)o, pt, sz); memmove((void *)o, pt, sz);
return realloc((void *)o, sz); return realloc((void *)o, sz);
} }
@ -690,7 +690,7 @@ static Atom write_atom(void *s0, seq_tv_t *out USES_REGS) {
} else { } else {
size_t n = get_utf8(s, -1, &ch); size_t n = get_utf8(s, -1, &ch);
unsigned char *buf = Malloc(n + 1); unsigned char *buf = Malloc(n + 1);
memcpy(buf, s0, n + 1); memmove(buf, s0, n + 1);
return Yap_ULookupAtom(buf); return Yap_ULookupAtom(buf);
} }
} }
@ -921,7 +921,7 @@ bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS) {
const unsigned char *ptr = skip_utf8(buf, out->max); const unsigned char *ptr = skip_utf8(buf, out->max);
size_t diff = (ptr - buf); size_t diff = (ptr - buf);
char *nbuf = Malloc(diff + 1); char *nbuf = Malloc(diff + 1);
memcpy(nbuf, buf, diff); memmove(nbuf, buf, diff);
nbuf[diff] = '\0'; nbuf[diff] = '\0';
leng = diff; leng = diff;
} }

View File

@ -85,7 +85,7 @@ void *protected_pop_text_stack(int i, void *protected, bool tmp,
out = LOCAL_FileNameBuf; out = LOCAL_FileNameBuf;
else else
out = p; out = p;
memcpy(out, protected, sz); memmove(out, protected, sz);
} else { } else {
free(p); free(p);
} }
@ -661,7 +661,7 @@ static Atom write_atom(void *s0, seq_tv_t *out, size_t leng USES_REGS) {
return Yap_LookupAtom(s0); return Yap_LookupAtom(s0);
} else { } else {
unsigned char *buf = Malloc(leng + 1); unsigned char *buf = Malloc(leng + 1);
memcpy(buf, s0, leng); memmove(buf, s0, leng);
buf[leng] = \0; buf[leng] = \0;
return Yap_ULookupAtom(buf); return Yap_ULookupAtom(buf);
} }
@ -872,7 +872,7 @@ bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS) {
size_t max_s = skip_utf8( buf, out-> max )-buf; size_t max_s = skip_utf8( buf, out-> max )-buf;
if (max_s < leng_s) { if (max_s < leng_s) {
char *nbuf = Malloc(max_s + 1); char *nbuf = Malloc(max_s + 1);
memcpy(nbuf, buf, max_s); memmove(nbuf, buf, max_s);
nbuf[max_s] = '\0'; nbuf[max_s] = '\0';
leng_s = out->max; leng_s = out->max;
} }

View File

@ -182,7 +182,7 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf,
if (HR+sz > ASP - 2048) { if (HR+sz > ASP - 2048) {
goto overflow; goto overflow;
} }
memcpy((void *)HR, (void *)ap2, sz*sizeof(CELL)); memmove((void *)HR, (void *)ap2, sz*sizeof(CELL));
HR += sz; HR += sz;
} else { } else {
*ptf++ = d0; /* you can just copy other extensions. */ *ptf++ = d0; /* you can just copy other extensions. */
@ -845,7 +845,7 @@ export_term_to_buffer(Term inpt, char *buf, char *bptr, CELL *t0 , CELL *tf, siz
if (buf + len < (char *)((CELL *)td + (tf-t0))) { if (buf + len < (char *)((CELL *)td + (tf-t0))) {
return FALSE; return FALSE;
} }
memcpy((void *)td, (void *)t0, (tf-t0)* sizeof(CELL)); memmove((void *)td, (void *)t0, (tf-t0)* sizeof(CELL));
bf[0] = (td-buf); bf[0] = (td-buf);
bf[1] = (tf-t0); bf[1] = (tf-t0);
bf[2] = inpt; bf[2] = inpt;
@ -945,7 +945,7 @@ export_complex_term(Term tf, CELL *pt0, CELL *pt0_end, char * buf, size_t len0,
if (HR+sz > ASP - 2048) { if (HR+sz > ASP - 2048) {
goto overflow; goto overflow;
} }
memcpy((void *)HR, (void *)ap2, sz*sizeof(CELL)); memmove((void *)HR, (void *)ap2, sz*sizeof(CELL));
HR += sz; HR += sz;
continue; continue;
} }
@ -1263,7 +1263,7 @@ Yap_ImportTerm(char * buf) {
return 0L; return 0L;
} }
} }
memcpy(HR, buf+bc[0], sizeof(CELL)*sz); memmove(HR, buf+bc[0], sizeof(CELL)*sz);
if (IsApplTerm(tinp)) { if (IsApplTerm(tinp)) {
tret = AbsAppl(HR); tret = AbsAppl(HR);
import_compound(HR, (char *)HR, buf, HR); import_compound(HR, (char *)HR, buf, HR);
@ -3476,7 +3476,7 @@ hash_complex_term(register CELL *pt0,
*st++ = LongIntOfTerm(d0); *st++ = LongIntOfTerm(d0);
break; break;
case (CELL)FunctorString: case (CELL)FunctorString:
memcpy(st, RepAppl(d0), (3+RepAppl(d0)[1])*sizeof(CELL)); memmove(st, RepAppl(d0), (3+RepAppl(d0)[1])*sizeof(CELL));
st += 3+RepAppl(d0)[1]; st += 3+RepAppl(d0)[1];
break; break;
#ifdef USE_GMP #ifdef USE_GMP
@ -3491,7 +3491,7 @@ hash_complex_term(register CELL *pt0,
goto global_overflow; goto global_overflow;
} }
/* then the actual number */ /* then the actual number */
memcpy((void *)(st+1), (void *)(pt+1), sz); memmove((void *)(st+1), (void *)(pt+1), sz);
st = st+sz/CellSize; st = st+sz/CellSize;
} }
break; break;

View File

@ -914,7 +914,7 @@ PredEntry *YAPPredicate::getPred(Term &t, CELL *&out) {
} else { } else {
ap = RepPredProp(PredPropByFunc(f, m)); ap = RepPredProp(PredPropByFunc(f, m));
if (out) if (out)
memcpy( out, RepAppl(t) + 1, ap->ArityOfPE*sizeof(CELL) ); memmove( out, RepAppl(t) + 1, ap->ArityOfPE*sizeof(CELL) );
else else
out = RepAppl(t) + 1; out = RepAppl(t) + 1;
} }

View File

@ -309,7 +309,6 @@ extern void Yap_DebugPlWriteln(Term t);
extern void Yap_DebugErrorPutc(int n); extern void Yap_DebugErrorPutc(int n);
extern void Yap_DebugErrorPuts(const char *s); extern void Yap_DebugErrorPuts(const char *s);
extern void Yap_DebugWriteIndicator(struct pred_entry *ap); extern void Yap_DebugWriteIndicator(struct pred_entry *ap);
extern void Yap_PlWriteToStream(Term, int, int);
extern void Yap_CloseReadline(void); extern void Yap_CloseReadline(void);
/* depth_lim.c */ /* depth_lim.c */
extern bool Yap_InitReadline(Term t); extern bool Yap_InitReadline(Term t);

View File

@ -181,14 +181,14 @@ INLINE_ONLY void init_absmi_regs(REGSTORE *absmi_regs);
INLINE_ONLY void init_absmi_regs(REGSTORE *absmi_regs) { INLINE_ONLY void init_absmi_regs(REGSTORE *absmi_regs) {
CACHE_REGS CACHE_REGS
memcpy(absmi_regs, Yap_regp, sizeof(REGSTORE)); memmove(absmi_regs, Yap_regp, sizeof(REGSTORE));
} }
INLINE_ONLY void restore_absmi_regs(REGSTORE *old_regs); INLINE_ONLY void restore_absmi_regs(REGSTORE *old_regs);
INLINE_ONLY void restore_absmi_regs(REGSTORE *old_regs) { INLINE_ONLY void restore_absmi_regs(REGSTORE *old_regs) {
CACHE_REGS CACHE_REGS
memcpy(old_regs, Yap_regp, sizeof(REGSTORE)); memmove(old_regs, Yap_regp, sizeof(REGSTORE));
#ifdef THREADS #ifdef THREADS
pthread_setspecific(Yap_yaamregs_key, (void *)old_regs); pthread_setspecific(Yap_yaamregs_key, (void *)old_regs);
LOCAL_ThreadHandle.current_yaam_regs = old_regs; LOCAL_ThreadHandle.current_yaam_regs = old_regs;

View File

@ -95,7 +95,7 @@ typedef enum{
t_createLowerExpectIntrinsicPass, //Removes llvm.expect intrinsics and creates "block_weights" metadata t_createLowerExpectIntrinsicPass, //Removes llvm.expect intrinsics and creates "block_weights" metadata
t_createLowerInvokePass, //Converts invoke and unwind instructions to use sjlj exception handling mechanisms t_createLowerInvokePass, //Converts invoke and unwind instructions to use sjlj exception handling mechanisms
t_createLowerSwitchPass, //Converts SwitchInst instructions into a sequence of chained binary branch instructions t_createLowerSwitchPass, //Converts SwitchInst instructions into a sequence of chained binary branch instructions
t_createMemCpyOptPass, //Performs optimizations related to eliminating memcpy calls and/or combining multiple stores into memset's t_createMemCpyOptPass, //Performs optimizations related to eliminating memmove calls and/or combining multiple stores into memset's
t_createMergeFunctionsPass, //Discovers identical functions and collapses them t_createMergeFunctionsPass, //Discovers identical functions and collapses them
t_createObjCARCAPElimPass, //ObjC ARC autorelease pool elimination t_createObjCARCAPElimPass, //ObjC ARC autorelease pool elimination
t_createObjCARCContractPass, //Late ObjC ARC cleanups t_createObjCARCContractPass, //Late ObjC ARC cleanups

View File

@ -95,7 +95,7 @@ typedef struct {
#define utarray_push_back(a,p) do { \ #define utarray_push_back(a,p) do { \
utarray_reserve(a,1); \ utarray_reserve(a,1); \
if ((a)->icd.copy) { (a)->icd.copy( _utarray_eltptr(a,(a)->i++), p); } \ if ((a)->icd.copy) { (a)->icd.copy( _utarray_eltptr(a,(a)->i++), p); } \
else { memcpy(_utarray_eltptr(a,(a)->i++), p, (a)->icd.sz); }; \ else { memmove(_utarray_eltptr(a,(a)->i++), p, (a)->icd.sz); }; \
} while(0) } while(0)
#define utarray_pop_back(a) do { \ #define utarray_pop_back(a) do { \
@ -123,7 +123,7 @@ typedef struct {
((a)->i - (j))*((a)->icd.sz)); \ ((a)->i - (j))*((a)->icd.sz)); \
} \ } \
if ((a)->icd.copy) { (a)->icd.copy( _utarray_eltptr(a,j), p); } \ if ((a)->icd.copy) { (a)->icd.copy( _utarray_eltptr(a,j), p); } \
else { memcpy(_utarray_eltptr(a,j), p, (a)->icd.sz); }; \ else { memmove(_utarray_eltptr(a,j), p, (a)->icd.sz); }; \
(a)->i++; \ (a)->i++; \
} while(0) } while(0)
@ -142,7 +142,7 @@ typedef struct {
(a)->icd.copy(_utarray_eltptr(a,j+_ut_i), _utarray_eltptr(w,_ut_i)); \ (a)->icd.copy(_utarray_eltptr(a,j+_ut_i), _utarray_eltptr(w,_ut_i)); \
} \ } \
} else { \ } else { \
memcpy(_utarray_eltptr(a,j), _utarray_eltptr(w,0), \ memmove(_utarray_eltptr(a,j), _utarray_eltptr(w,0), \
utarray_len(w)*((a)->icd.sz)); \ utarray_len(w)*((a)->icd.sz)); \
} \ } \
(a)->i += utarray_len(w); \ (a)->i += utarray_len(w); \

View File

@ -95,7 +95,7 @@ typedef enum{
t_createLowerExpectIntrinsicPass, //Removes llvm.expect intrinsics and creates "block_weights" metadata t_createLowerExpectIntrinsicPass, //Removes llvm.expect intrinsics and creates "block_weights" metadata
t_createLowerInvokePass, //Converts invoke and unwind instructions to use sjlj exception handling mechanisms t_createLowerInvokePass, //Converts invoke and unwind instructions to use sjlj exception handling mechanisms
t_createLowerSwitchPass, //Converts SwitchInst instructions into a sequence of chained binary branch instructions t_createLowerSwitchPass, //Converts SwitchInst instructions into a sequence of chained binary branch instructions
t_createMemCpyOptPass, //Performs optimizations related to eliminating memcpy calls and/or combining multiple stores into memset's t_createMemCpyOptPass, //Performs optimizations related to eliminating memmove calls and/or combining multiple stores into memset's
t_createMergeFunctionsPass, //Discovers identical functions and collapses them t_createMergeFunctionsPass, //Discovers identical functions and collapses them
t_createObjCARCAPElimPass, //ObjC ARC autorelease pool elimination t_createObjCARCAPElimPass, //ObjC ARC autorelease pool elimination
t_createObjCARCContractPass, //Late ObjC ARC cleanups t_createObjCARCContractPass, //Late ObjC ARC cleanups

View File

@ -66,29 +66,29 @@ static void share_private_nodes(int worker_q);
#endif #endif
#define P_COPY_GLOBAL_TO(Q) \ #define P_COPY_GLOBAL_TO(Q) \
memcpy((void *) (worker_offset(Q) + REMOTE_start_global_copy(Q)), \ memmove((void *) (worker_offset(Q) + REMOTE_start_global_copy(Q)), \
(void *) REMOTE_start_global_copy(Q), \ (void *) REMOTE_start_global_copy(Q), \
(size_t) (REMOTE_end_global_copy(Q) - REMOTE_start_global_copy(Q))) (size_t) (REMOTE_end_global_copy(Q) - REMOTE_start_global_copy(Q)))
#define Q_COPY_GLOBAL_FROM(P) \ #define Q_COPY_GLOBAL_FROM(P) \
memcpy((void *) LOCAL_start_global_copy, \ memmove((void *) LOCAL_start_global_copy, \
(void *) (worker_offset(P) + LOCAL_start_global_copy), \ (void *) (worker_offset(P) + LOCAL_start_global_copy), \
(size_t) (LOCAL_end_global_copy - LOCAL_start_global_copy)) (size_t) (LOCAL_end_global_copy - LOCAL_start_global_copy))
#define P_COPY_LOCAL_TO(Q) \ #define P_COPY_LOCAL_TO(Q) \
memcpy((void *) (worker_offset(Q) + REMOTE_start_local_copy(Q)), \ memmove((void *) (worker_offset(Q) + REMOTE_start_local_copy(Q)), \
(void *) REMOTE_start_local_copy(Q), \ (void *) REMOTE_start_local_copy(Q), \
(size_t) (REMOTE_end_local_copy(Q) - REMOTE_start_local_copy(Q))) (size_t) (REMOTE_end_local_copy(Q) - REMOTE_start_local_copy(Q)))
#define Q_COPY_LOCAL_FROM(P) \ #define Q_COPY_LOCAL_FROM(P) \
memcpy((void *) LOCAL_start_local_copy, \ memmove((void *) LOCAL_start_local_copy, \
(void *) (worker_offset(P) + LOCAL_start_local_copy), \ (void *) (worker_offset(P) + LOCAL_start_local_copy), \
(size_t) (LOCAL_end_local_copy - LOCAL_start_local_copy)) (size_t) (LOCAL_end_local_copy - LOCAL_start_local_copy))
#define P_COPY_TRAIL_TO(Q) \ #define P_COPY_TRAIL_TO(Q) \
memcpy((void *) (worker_offset(Q) + REMOTE_start_trail_copy(Q)), \ memmove((void *) (worker_offset(Q) + REMOTE_start_trail_copy(Q)), \
(void *) REMOTE_start_trail_copy(Q), \ (void *) REMOTE_start_trail_copy(Q), \
(size_t) (REMOTE_end_trail_copy(Q) - REMOTE_start_trail_copy(Q))) (size_t) (REMOTE_end_trail_copy(Q) - REMOTE_start_trail_copy(Q)))
#define Q_COPY_TRAIL_FROM(P) \ #define Q_COPY_TRAIL_FROM(P) \
memcpy((void *) LOCAL_start_trail_copy, \ memmove((void *) LOCAL_start_trail_copy, \
(void *) (worker_offset(P) + LOCAL_start_trail_copy), \ (void *) (worker_offset(P) + LOCAL_start_trail_copy), \
(size_t) (LOCAL_end_trail_copy - LOCAL_start_trail_copy)) (size_t) (LOCAL_end_trail_copy - LOCAL_start_trail_copy))

View File

@ -409,13 +409,13 @@ void resume_suspension_frame(susp_fr_ptr resume_fr, or_fr_ptr top_or_fr) {
sg_fr_ptr sg_frame; sg_fr_ptr sg_frame;
/* copy suspended stacks */ /* copy suspended stacks */
memcpy(SuspFr_global_reg(resume_fr), memmove(SuspFr_global_reg(resume_fr),
SuspFr_global_start(resume_fr), SuspFr_global_start(resume_fr),
SuspFr_global_size(resume_fr)); SuspFr_global_size(resume_fr));
memcpy(SuspFr_local_reg(resume_fr), memmove(SuspFr_local_reg(resume_fr),
SuspFr_local_start(resume_fr), SuspFr_local_start(resume_fr),
SuspFr_local_size(resume_fr)); SuspFr_local_size(resume_fr));
memcpy(SuspFr_trail_reg(resume_fr), memmove(SuspFr_trail_reg(resume_fr),
SuspFr_trail_start(resume_fr), SuspFr_trail_start(resume_fr),
SuspFr_trail_size(resume_fr)); SuspFr_trail_size(resume_fr));

View File

@ -574,9 +574,9 @@ typedef enum {
SuspFr_global_size(SUSP_FR) = H_SIZE; \ SuspFr_global_size(SUSP_FR) = H_SIZE; \
SuspFr_local_size(SUSP_FR) = B_SIZE; \ SuspFr_local_size(SUSP_FR) = B_SIZE; \
SuspFr_trail_size(SUSP_FR) = TR_SIZE; \ SuspFr_trail_size(SUSP_FR) = TR_SIZE; \
memcpy(SuspFr_global_start(SUSP_FR), SuspFr_global_reg(SUSP_FR), H_SIZE); \ memmove(SuspFr_global_start(SUSP_FR), SuspFr_global_reg(SUSP_FR), H_SIZE); \
memcpy(SuspFr_local_start(SUSP_FR), SuspFr_local_reg(SUSP_FR), B_SIZE); \ memmove(SuspFr_local_start(SUSP_FR), SuspFr_local_reg(SUSP_FR), B_SIZE); \
memcpy(SuspFr_trail_start(SUSP_FR), SuspFr_trail_reg(SUSP_FR), TR_SIZE) memmove(SuspFr_trail_start(SUSP_FR), SuspFr_trail_reg(SUSP_FR), TR_SIZE)
#define new_subgoal_trie_node(NODE, ENTRY, CHILD, PARENT, NEXT) \ #define new_subgoal_trie_node(NODE, ENTRY, CHILD, PARENT, NEXT) \
ALLOC_SUBGOAL_TRIE_NODE(NODE); \ ALLOC_SUBGOAL_TRIE_NODE(NODE); \

View File

@ -665,12 +665,12 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str,
bucket = Hash_buckets(hash); bucket = Hash_buckets(hash);
last_bucket = bucket + Hash_num_buckets(hash); last_bucket = bucket + Hash_num_buckets(hash);
current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1)); current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1));
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1)); memmove(current_arity, arity, sizeof(int) * (arity[0] + 1));
do { do {
if (*bucket) { if (*bucket) {
traverse_subgoal_trie(*bucket, str, str_index, arity, mode, traverse_subgoal_trie(*bucket, str, str_index, arity, mode,
TRAVERSE_POSITION_FIRST PASS_REGS); TRAVERSE_POSITION_FIRST PASS_REGS);
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1)); memmove(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS #ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[') if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
str[str_index - 1] = ','; str[str_index - 1] = ',';
@ -687,7 +687,7 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str,
/* save current state if first sibling node */ /* save current state if first sibling node */
if (position == TRAVERSE_POSITION_FIRST) { if (position == TRAVERSE_POSITION_FIRST) {
current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1)); current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1));
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1)); memmove(current_arity, arity, sizeof(int) * (arity[0] + 1));
current_str_index = str_index; current_str_index = str_index;
current_mode = mode; current_mode = mode;
} }
@ -737,7 +737,7 @@ static void traverse_subgoal_trie(sg_node_ptr current_node, char *str,
mode = current_mode; mode = current_mode;
current_node = TrNode_next(current_node); current_node = TrNode_next(current_node);
while (current_node) { while (current_node) {
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1)); memmove(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS #ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[') if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
str[str_index - 1] = ','; str[str_index - 1] = ',';
@ -768,12 +768,12 @@ static void traverse_answer_trie(ans_node_ptr current_node, char *str,
bucket = Hash_buckets(hash); bucket = Hash_buckets(hash);
last_bucket = bucket + Hash_num_buckets(hash); last_bucket = bucket + Hash_num_buckets(hash);
current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1)); current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1));
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1)); memmove(current_arity, arity, sizeof(int) * (arity[0] + 1));
do { do {
if (*bucket) { if (*bucket) {
traverse_answer_trie(*bucket, str, str_index, arity, var_index, mode, traverse_answer_trie(*bucket, str, str_index, arity, var_index, mode,
TRAVERSE_POSITION_FIRST PASS_REGS); TRAVERSE_POSITION_FIRST PASS_REGS);
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1)); memmove(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS #ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[') if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
str[str_index - 1] = ','; str[str_index - 1] = ',';
@ -790,7 +790,7 @@ static void traverse_answer_trie(ans_node_ptr current_node, char *str,
/* save current state if first sibling node */ /* save current state if first sibling node */
if (position == TRAVERSE_POSITION_FIRST) { if (position == TRAVERSE_POSITION_FIRST) {
current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1)); current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1));
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1)); memmove(current_arity, arity, sizeof(int) * (arity[0] + 1));
current_str_index = str_index; current_str_index = str_index;
current_var_index = var_index; current_var_index = var_index;
current_mode = mode; current_mode = mode;
@ -832,7 +832,7 @@ static void traverse_answer_trie(ans_node_ptr current_node, char *str,
mode = current_mode; mode = current_mode;
current_node = TrNode_next(current_node); current_node = TrNode_next(current_node);
while (current_node) { while (current_node) {
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1)); memmove(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS #ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[') if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
str[str_index - 1] = ','; str[str_index - 1] = ',';
@ -863,12 +863,12 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str,
bucket = Hash_buckets(hash); bucket = Hash_buckets(hash);
last_bucket = bucket + Hash_num_buckets(hash); last_bucket = bucket + Hash_num_buckets(hash);
current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1)); current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1));
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1)); memmove(current_arity, arity, sizeof(int) * (arity[0] + 1));
do { do {
if (*bucket) { if (*bucket) {
traverse_global_trie(*bucket, str, str_index, arity, mode, traverse_global_trie(*bucket, str, str_index, arity, mode,
TRAVERSE_POSITION_FIRST PASS_REGS); TRAVERSE_POSITION_FIRST PASS_REGS);
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1)); memmove(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS #ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[') if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
str[str_index - 1] = ','; str[str_index - 1] = ',';
@ -885,7 +885,7 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str,
/* save current state if first sibling node */ /* save current state if first sibling node */
if (position == TRAVERSE_POSITION_FIRST) { if (position == TRAVERSE_POSITION_FIRST) {
current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1)); current_arity = (int *)malloc(sizeof(int) * (arity[0] + 1));
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1)); memmove(current_arity, arity, sizeof(int) * (arity[0] + 1));
current_str_index = str_index; current_str_index = str_index;
current_mode = mode; current_mode = mode;
} }
@ -913,7 +913,7 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str,
mode = current_mode; mode = current_mode;
current_node = TrNode_next(current_node); current_node = TrNode_next(current_node);
while (current_node) { while (current_node) {
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1)); memmove(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
#ifdef TRIE_COMPACT_PAIRS #ifdef TRIE_COMPACT_PAIRS
if (arity[arity[0]] == -2 && str[str_index - 1] != '[') if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
str[str_index - 1] = ','; str[str_index - 1] = ',';
@ -1200,7 +1200,7 @@ sg_fr_ptr subgoal_search(yamop *preg, CELL **Yaddr) {
#ifdef MODE_DIRECTED_TABLING #ifdef MODE_DIRECTED_TABLING
if (subs_pos) { if (subs_pos) {
ALLOC_BLOCK(mode_directed, subs_pos * sizeof(int), int); ALLOC_BLOCK(mode_directed, subs_pos * sizeof(int), int);
memcpy((void *)mode_directed, (void *)aux_mode_directed, memmove((void *)mode_directed, (void *)aux_mode_directed,
subs_pos * sizeof(int)); subs_pos * sizeof(int));
} else } else
mode_directed = NULL; mode_directed = NULL;

View File

@ -77,7 +77,7 @@
#define copy_aux_stack() \ #define copy_aux_stack() \
{ arity_t size = 3 + heap_arity + subs_arity + vars_arity; \ { arity_t size = 3 + heap_arity + subs_arity + vars_arity; \
TOP_STACK -= size; \ TOP_STACK -= size; \
memcpy(TOP_STACK, aux_stack, size * sizeof(CELL *)); \ memmove(TOP_STACK, aux_stack, size * sizeof(CELL *)); \
aux_stack = TOP_STACK; \ aux_stack = TOP_STACK; \
}/* macros 'store_trie_node', 'restore_trie_node' and 'pop_trie_node' ** }/* macros 'store_trie_node', 'restore_trie_node' and 'pop_trie_node' **
** do not include 'set_cut' because trie instructions are cut safe */ ** do not include 'set_cut' because trie instructions are cut safe */

View File

@ -77,7 +77,7 @@
#define copy_aux_stack() \ #define copy_aux_stack() \
{ int size = 3 + heap_arity + subs_arity + vars_arity; \ { int size = 3 + heap_arity + subs_arity + vars_arity; \
TOP_STACK -= size; \ TOP_STACK -= size; \
memcpy(TOP_STACK, aux_stack, size * sizeof(CELL *)); \ memmove(TOP_STACK, aux_stack, size * sizeof(CELL *)); \
aux_stack = TOP_STACK; \ aux_stack = TOP_STACK; \
}/* macros 'store_trie_node', 'restore_trie_node' and 'pop_trie_node' ** }/* macros 'store_trie_node', 'restore_trie_node' and 'pop_trie_node' **
** do not include 'set_cut' because trie instructions are cut safe */ ** do not include 'set_cut' because trie instructions are cut safe */

View File

@ -496,7 +496,7 @@
/* Define to 1 if you have the `mbsnrtowcs' function. */ /* Define to 1 if you have the `mbsnrtowcs' function. */
#undef HAVE_MBSNRTOWCS #undef HAVE_MBSNRTOWCS
/* Define to 1 if you have the `memcpy' function. */ /* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMCPY #undef HAVE_MEMCPY
/* Define to 1 if you have the `memmove' function. */ /* Define to 1 if you have the `memmove' function. */

View File

@ -1767,7 +1767,7 @@ AC_CHECK_FUNCS(localeconv localtime lstat mallinfo)
AC_CHECK_FUNCS(mbscoll) AC_CHECK_FUNCS(mbscoll)
AC_CHECK_FUNCS(mbscasecoll) AC_CHECK_FUNCS(mbscasecoll)
AC_CHECK_FUNCS(mbsnrtowcs) AC_CHECK_FUNCS(mbsnrtowcs)
AC_CHECK_FUNCS(memcpy memmove mkstemp mktemp) AC_CHECK_FUNCS(memmove memmove mkstemp mktemp)
AC_CHECK_FUNCS(nanosleep mktime opendir) AC_CHECK_FUNCS(nanosleep mktime opendir)
AC_CHECK_FUNCS(putenv rand random drand48) AC_CHECK_FUNCS(putenv rand random drand48)
AC_CHECK_FUNCS(readlink realpath regexec) AC_CHECK_FUNCS(readlink realpath regexec)

View File

@ -291,7 +291,7 @@ check_symbol_exists(mallinfo " malloc.h" HAVE_MALLINFO)
check_function_exists(mbscoll HAVE_MBSCOLL) check_function_exists(mbscoll HAVE_MBSCOLL)
check_function_exists(mbscasecoll HAVE_MBSCASECOLL) check_function_exists(mbscasecoll HAVE_MBSCASECOLL)
check_function_exists(mbsnrtowcs HAVE_MBSNRTOWCS) check_function_exists(mbsnrtowcs HAVE_MBSNRTOWCS)
check_function_exists(memcpy HAVE_MEMCPY) check_function_exists(memmove HAVE_MEMCPY)
check_function_exists(memmove HAVE_MEMMOVE) check_function_exists(memmove HAVE_MEMMOVE)
check_function_exists(mkstemp HAVE_MKSTEMP) check_function_exists(mkstemp HAVE_MKSTEMP)
check_function_exists(mktemp HAVE_MKTEMP) check_function_exists(mktemp HAVE_MKTEMP)

View File

@ -897,7 +897,7 @@ function. */
#cmakedefine HAVE_MBSNRTOWCS ${HAVE_MBSNRTOWCS} #cmakedefine HAVE_MBSNRTOWCS ${HAVE_MBSNRTOWCS}
#endif #endif
/* Define to 1 if you have the `memcpy' function. */ /* Define to 1 if you have the `memmove' function. */
#ifndef HAVE_MEMCPY #ifndef HAVE_MEMCPY
#cmakedefine HAVE_MEMCPY ${HAVE_MEMCPY} #cmakedefine HAVE_MEMCPY ${HAVE_MEMCPY}
#endif #endif

View File

@ -356,7 +356,7 @@ Srlc_write(void *handle, char *buffer, size_t size)
{ char buf[sizeof(TCHAR)]; /* Pad to TCHAR */ { char buf[sizeof(TCHAR)]; /* Pad to TCHAR */
size_t i = sizeof(TCHAR) - (size-n); size_t i = sizeof(TCHAR) - (size-n);
memcpy(buf, buffer+n, i); memmove(buf, buffer+n, i);
for(; i<sizeof(TCHAR); i++) for(; i<sizeof(TCHAR); i++)
buf[i] = '?'; buf[i] = '?';
rlc_write(c, (TCHAR*)buffer, 1); rlc_write(c, (TCHAR*)buffer, 1);

View File

@ -26,7 +26,7 @@
*/ */
:- module(charsio, [ :- module(system(charsio), [
format_to_chars/3, format_to_chars/3,
format_to_chars/4, format_to_chars/4,
write_to_chars/3, write_to_chars/3,

View File

@ -593,7 +593,7 @@ Bfree
} }
} }
#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ #define Bcopy(x,y) memmove((char *)&x->sign, (char *)&y->sign, \
y->wds*sizeof(Long) + 2*sizeof(int)) y->wds*sizeof(Long) + 2*sizeof(int))
static Bigint * static Bigint *

View File

@ -42,7 +42,7 @@ growBuffer(Buffer b, size_t minfree)
{ if ( !(new = malloc(sz)) ) { if ( !(new = malloc(sz)) )
return FALSE; return FALSE;
memcpy(new, b->static_buffer, osz); memmove(new, b->static_buffer, osz);
} else } else
{ if ( !(new = realloc(b->base, sz)) ) { if ( !(new = realloc(b->base, sz)) )
return FALSE; return FALSE;

View File

@ -2381,7 +2381,7 @@ re_buffer(IOSTREAM *s, const char *from, size_t len)
{ s->bufp = s->limitp = s->buffer; { s->bufp = s->limitp = s->buffer;
} }
memcpy(s->bufp, from, len); memmove(s->bufp, from, len);
s->bufp += len; s->bufp += len;
} }
@ -5846,7 +5846,7 @@ struct PL_local_data *Yap_InitThreadIO(int wid)
return p; return p;
} }
#if THREADS #if THREADS
memcpy(p, Yap_local[0]->PL_local_data_p_, sizeof(struct PL_local_data)); memmove(p, Yap_local[0]->PL_local_data_p_, sizeof(struct PL_local_data));
#endif #endif
return p; return p;
} }

View File

@ -1426,7 +1426,7 @@ localizeDecimalPoint(PL_locale *locale, Buffer b)
if ( strncmp(e, ddp, ddplen) == 0 ) if ( strncmp(e, ddp, ddplen) == 0 )
{ if ( dplen == ddplen ) { if ( dplen == ddplen )
{ memcpy(e, dp, dplen); { memmove(e, dp, dplen);
} else } else
{ char *ob = baseBuffer(b, char); { char *ob = baseBuffer(b, char);
if ( dplen > ddplen && !growBuffer(b, dplen-ddplen) ) if ( dplen > ddplen && !growBuffer(b, dplen-ddplen) )
@ -1434,7 +1434,7 @@ localizeDecimalPoint(PL_locale *locale, Buffer b)
e += baseBuffer(b, char) - ob; e += baseBuffer(b, char) - ob;
memmove(&e[dplen-ddplen], e, strlen(e)+1); memmove(&e[dplen-ddplen], e, strlen(e)+1);
memcpy(e, dp, dplen); memmove(e, dp, dplen);
} }
} }
} }
@ -1477,7 +1477,7 @@ groupDigits(PL_locale *locale, Buffer b)
{ *o-- = *e--; { *o-- = *e--;
if ( --gsize == 0 && e>=s ) if ( --gsize == 0 && e>=s )
{ o -= thslen-1; { o -= thslen-1;
memcpy(o, ths, thslen); memmove(o, ths, thslen);
o--; o--;
if ( grouping[1] == 0 ) if ( grouping[1] == 0 )
gsize = grouping[0]; gsize = grouping[0];

View File

@ -429,7 +429,7 @@ win_exec(size_t len, const wchar_t *cmd, UINT show)
/* ensure 0-terminated */ /* ensure 0-terminated */
wcmd = PL_malloc((len+1)*sizeof(wchar_t)); wcmd = PL_malloc((len+1)*sizeof(wchar_t));
memcpy(wcmd, cmd, len*sizeof(wchar_t)); memmove(wcmd, cmd, len*sizeof(wchar_t));
wcmd[len] = 0; wcmd[len] = 0;
rval = CreateProcessW(NULL, /* app */ rval = CreateProcessW(NULL, /* app */

View File

@ -953,7 +953,7 @@ getenv3(const char *name, char *buf, size_t len)
if ( s ) if ( s )
{ if ( (l=strlen(s)) < len ) { if ( (l=strlen(s)) < len )
memcpy(buf, s, l+1); memmove(buf, s, l+1);
else if ( len > 0 ) else if ( len > 0 )
buf[0] = EOS; /* empty string if not fit */ buf[0] = EOS; /* empty string if not fit */

View File

@ -253,7 +253,7 @@ static void growToBuffer(int c, ReadData _PL_rd) {
if (rb.base == rb.fast) /* intptr_t clause: jump to use malloc() */ if (rb.base == rb.fast) /* intptr_t clause: jump to use malloc() */
{ {
rb.base = PL_malloc(FASTBUFFERSIZE * 2); rb.base = PL_malloc(FASTBUFFERSIZE * 2);
memcpy(rb.base, rb.fast, FASTBUFFERSIZE); memmove(rb.base, rb.fast, FASTBUFFERSIZE);
} else } else
rb.base = PL_realloc(rb.base, rb.size * 2); rb.base = PL_realloc(rb.base, rb.size * 2);

View File

@ -491,7 +491,7 @@ Sread_readline(void *handle, char *buf, size_t size)
{ PL_warning("Input line too long"); /* must be tested! */ { PL_warning("Input line too long"); /* must be tested! */
l = size-1; l = size-1;
} }
memcpy(buf, line, l); memmove(buf, line, l);
buf[l++] = '\n'; buf[l++] = '\n';
rval = l; rval = l;

View File

@ -239,7 +239,7 @@ S__setbuf(IOSTREAM *s, char *buffer, size_t size)
} }
} }
memcpy(newbuf, s->bufp, copy); memmove(newbuf, s->bufp, copy);
S__removebuf(s); S__removebuf(s);
s->unbuffer = newunbuf; s->unbuffer = newunbuf;
s->bufp = s->buffer = newbuf; s->bufp = s->buffer = newbuf;
@ -1173,7 +1173,7 @@ Speekcode(IOSTREAM *s)
if ( s->bufp + UNDO_SIZE > s->limitp && !(s->flags&SIO_USERBUF) ) if ( s->bufp + UNDO_SIZE > s->limitp && !(s->flags&SIO_USERBUF) )
{ safe = s->limitp - s->bufp; { safe = s->limitp - s->bufp;
memcpy(s->buffer-safe, s->bufp, safe); memmove(s->buffer-safe, s->bufp, safe);
} }
start = s->bufp; start = s->bufp;
@ -1262,11 +1262,11 @@ Sfread(void *data, size_t size, size_t elms, IOSTREAM *s)
{ size_t avail = s->limitp - s->bufp; { size_t avail = s->limitp - s->bufp;
if ( chars <= avail ) if ( chars <= avail )
{ memcpy(buf, s->bufp, chars); { memmove(buf, s->bufp, chars);
s->bufp += chars; s->bufp += chars;
return elms; return elms;
} else } else
{ memcpy(buf, s->bufp, avail); { memmove(buf, s->bufp, avail);
chars -= avail; chars -= avail;
buf += avail; buf += avail;
s->bufp += avail; s->bufp += avail;
@ -1325,7 +1325,7 @@ Sread_pending(IOSTREAM *s, char *buf, size_t limit, int flags)
n = s->limitp - s->bufp; n = s->limitp - s->bufp;
if ( n > limit ) if ( n > limit )
n = limit; n = limit;
memcpy(&buf[done], s->bufp, n); memmove(&buf[done], s->bufp, n);
s->bufp += n; s->bufp += n;
return done+n; return done+n;
@ -3439,7 +3439,7 @@ Swrite_memfile(void *handle, char *buf, size_t size)
} }
if ( !mf->malloced ) if ( !mf->malloced )
{ if ( mf->buffer ) { if ( mf->buffer )
memcpy(nb, mf->buffer, mf->allocated); memmove(nb, mf->buffer, mf->allocated);
mf->malloced = TRUE; mf->malloced = TRUE;
} }
} else } else
@ -3453,7 +3453,7 @@ Swrite_memfile(void *handle, char *buf, size_t size)
*mf->bufferp = mf->buffer = nb; *mf->bufferp = mf->buffer = nb;
} }
memcpy(&mf->buffer[mf->here], buf, size); memmove(&mf->buffer[mf->here], buf, size);
mf->here += size; mf->here += size;
if ( mf->here > mf->size ) if ( mf->here > mf->size )
@ -3478,7 +3478,7 @@ Sread_memfile(void *handle, char *buf, size_t size)
size = mf->size - mf->here; size = mf->size - mf->here;
} }
memcpy(buf, &mf->buffer[mf->here], size); memmove(buf, &mf->buffer[mf->here], size);
mf->here += size; mf->here += size;
return size; return size;

View File

@ -69,7 +69,7 @@ PL_save_text(PL_chars_t *text, int flags)
{ size_t bl = bufsize_text(text, text->length+1); { size_t bl = bufsize_text(text, text->length+1);
void *new = PL_malloc(bl); void *new = PL_malloc(bl);
memcpy(new, text->text.t, bl); memmove(new, text->text.t, bl);
text->text.t = new; text->text.t = new;
text->storage = PL_CHARS_MALLOC; text->storage = PL_CHARS_MALLOC;
} else if ( text->storage == PL_CHARS_LOCAL ) } else if ( text->storage == PL_CHARS_LOCAL )
@ -104,7 +104,7 @@ PL_from_stack_text(PL_chars_t *text)
{ size_t bl = bufsize_text(text, text->length+1); { size_t bl = bufsize_text(text, text->length+1);
if ( bl < sizeof(text->buf) ) if ( bl < sizeof(text->buf) )
{ memcpy(text->buf, text->text.t, bl); { memmove(text->buf, text->text.t, bl);
text->text.t = text->buf; text->text.t = text->buf;
text->storage = PL_CHARS_LOCAL; text->storage = PL_CHARS_LOCAL;
} else } else
@ -135,7 +135,7 @@ ui64toa(uint64_t val, char *out)
} while ( val ); } while ( val );
nbDigs = ptrOrg - ptr; nbDigs = ptrOrg - ptr;
memcpy(out, ptr, nbDigs); memmove(out, ptr, nbDigs);
out += nbDigs; out += nbDigs;
*out = '\0'; *out = '\0';
@ -610,7 +610,7 @@ PL_promote_text(PL_chars_t *text)
unsigned char *e = &buf[text->length]; unsigned char *e = &buf[text->length];
pl_wchar_t *t = (pl_wchar_t*)text->buf; pl_wchar_t *t = (pl_wchar_t*)text->buf;
memcpy(buf, text->buf, text->length*sizeof(char)); memmove(buf, text->buf, text->length*sizeof(char));
while(f<e) while(f<e)
{ *t++ = *f++; { *t++ = *f++;
} }
@ -663,7 +663,7 @@ PL_demote_text(PL_chars_t *text)
pl_wchar_t *e = &buf[text->length]; pl_wchar_t *e = &buf[text->length];
char *t = text->buf; char *t = text->buf;
memcpy(buf, text->buf, text->length*sizeof(pl_wchar_t)); memmove(buf, text->buf, text->length*sizeof(pl_wchar_t));
while(f<e) while(f<e)
{ if ( *f > 0xff ) { if ( *f > 0xff )
return FALSE; return FALSE;
@ -1021,7 +1021,7 @@ PL_canonise_text(PL_chars_t *text)
text->encoding = ENC_WCHAR; text->encoding = ENC_WCHAR;
if ( len+1 < sizeof(text->buf)/sizeof(wchar_t) ) if ( len+1 < sizeof(text->buf)/sizeof(wchar_t) )
{ if ( text->text.t == text->buf ) { if ( text->text.t == text->buf )
{ memcpy(b2, text->buf, sizeof(text->buf)); { memmove(b2, text->buf, sizeof(text->buf));
from = b2; from = b2;
} }
text->text.w = (wchar_t*)text->buf; text->text.w = (wchar_t*)text->buf;
@ -1239,7 +1239,7 @@ PL_concat_text(int n, PL_chars_t **text, PL_chars_t *result)
} }
for(to=result->text.t, i=0; i<n; i++) for(to=result->text.t, i=0; i<n; i++)
{ memcpy(to, text[i]->text.t, text[i]->length); { memmove(to, text[i]->text.t, text[i]->length);
to += text[i]->length; to += text[i]->length;
} }
*to = EOS; *to = EOS;
@ -1257,7 +1257,7 @@ PL_concat_text(int n, PL_chars_t **text, PL_chars_t *result)
for(to=result->text.w, i=0; i<n; i++) for(to=result->text.w, i=0; i<n; i++)
{ if ( text[i]->encoding == ENC_WCHAR ) { if ( text[i]->encoding == ENC_WCHAR )
{ memcpy(to, text[i]->text.w, text[i]->length*sizeof(pl_wchar_t)); { memmove(to, text[i]->text.w, text[i]->length*sizeof(pl_wchar_t));
to += text[i]->length; to += text[i]->length;
} else } else
{ const unsigned char *f = (const unsigned char *)text[i]->text.t; { const unsigned char *f = (const unsigned char *)text[i]->text.t;

View File

@ -137,7 +137,7 @@ format_float(double f, char *buf)
{ *o++ = s[0]; { *o++ = s[0];
*o++ = '.'; *o++ = '.';
if ( end-s > 1 ) if ( end-s > 1 )
{ memcpy(o, s+1, end-s-1); { memmove(o, s+1, end-s-1);
o += end-s-1; o += end-s-1;
} else } else
*o++ = '0'; *o++ = '0';
@ -149,14 +149,14 @@ format_float(double f, char *buf)
*o++ = '.'; *o++ = '.';
for(i=0; i < -decpt; i++) for(i=0; i < -decpt; i++)
*o++ = '0'; *o++ = '0';
memcpy(o, s, end-s); memmove(o, s, end-s);
o[end-s] = 0; o[end-s] = 0;
} }
} else if ( end-s > decpt ) /* decimal dot inside */ } else if ( end-s > decpt ) /* decimal dot inside */
{ memcpy(o, s, decpt); { memmove(o, s, decpt);
o += decpt; o += decpt;
*o++ = '.'; *o++ = '.';
memcpy(o, s+decpt, end-s-decpt); memmove(o, s+decpt, end-s-decpt);
o[end-s-decpt] = 0; o[end-s-decpt] = 0;
} else /* decimal dot after */ } else /* decimal dot after */
{ int i; { int i;
@ -167,13 +167,13 @@ format_float(double f, char *buf)
*o++ = '.'; *o++ = '.';
if ( end-s > 1 ) if ( end-s > 1 )
{ trailing += (int)(end-s)-1; { trailing += (int)(end-s)-1;
memcpy(o, s+1, end-s-1); memmove(o, s+1, end-s-1);
o += end-s-1; o += end-s-1;
} else } else
*o++ = '0'; *o++ = '0';
sprintf(o, "e+%d", trailing); sprintf(o, "e+%d", trailing);
} else /* within precision trail with .0 */ } else /* within precision trail with .0 */
{ memcpy(o, s, end-s); { memmove(o, s, end-s);
o += end-s; o += end-s;
for(i=(int)(end-s); i<decpt; i++) for(i=(int)(end-s); i<decpt; i++)

View File

@ -159,7 +159,7 @@ new_int_matrix(int ndims, int dims[], long int data[])
} }
bdata = matrix_long_data(mat,ndims); bdata = matrix_long_data(mat,ndims);
if (data) if (data)
memcpy((void *)bdata,(void *)data,sizeof(double)*nelems); memmove((void *)bdata,(void *)data,sizeof(double)*nelems);
return blob; return blob;
} }
@ -193,7 +193,7 @@ new_float_matrix(int ndims, int dims[], double data[])
} }
bdata = matrix_double_data(mat,ndims); bdata = matrix_double_data(mat,ndims);
if (data) if (data)
memcpy((void *)bdata,(void *)data,sizeof(double)*nelems); memmove((void *)bdata,(void *)data,sizeof(double)*nelems);
return blob; return blob;
} }

View File

@ -88,7 +88,7 @@ expand_buffer( int space )
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "out of memory" ); Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "out of memory" );
Yap_exit( EXIT_FAILURE ); Yap_exit( EXIT_FAILURE );
} }
memcpy( tmp, buf, bufsize ); memmove( tmp, buf, bufsize );
free( buf ); free( buf );
buf = tmp; buf = tmp;
#else /* use realloc */ #else /* use realloc */

View File

@ -1539,7 +1539,7 @@ sopno finish; /* to this less one */
return (ret); return (ret);
enlarge(p, p->ssize + len); /* this many unexpected additions */ enlarge(p, p->ssize + len); /* this many unexpected additions */
assert(p->ssize >= p->slen + len); assert(p->ssize >= p->slen + len);
(void)memcpy((char *)(p->strip + p->slen), (char *)(p->strip + start), (void)memmove((char *)(p->strip + p->slen), (char *)(p->strip + start),
(size_t)len * sizeof(sop)); (size_t)len * sizeof(sop));
p->slen += len; p->slen += len;
return (ret); return (ret);

View File

@ -130,7 +130,7 @@ static int nope = 0; /* for use in asserts; shuts lint up */
#define SET0(v, n) ((v)[n] = 0) #define SET0(v, n) ((v)[n] = 0)
#define SET1(v, n) ((v)[n] = 1) #define SET1(v, n) ((v)[n] = 1)
#define ISSET(v, n) ((v)[n]) #define ISSET(v, n) ((v)[n])
#define ASSIGN(d, s) memcpy(d, s, m->g->nstates) #define ASSIGN(d, s) memmove(d, s, m->g->nstates)
#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0) #define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
#define STATEVARS \ #define STATEVARS \
long vn; \ long vn; \

View File

@ -153,8 +153,8 @@ RL_Tree *copy_rl(RL_Tree *tree) {
free(new); free(new);
return NULL; return NULL;
} }
memcpy(new, tree, sizeof(RL_Tree)); memmove(new, tree, sizeof(RL_Tree));
memcpy(buf_ptr, &tree->root[0], tree->size * NODE_SIZE); memmove(buf_ptr, &tree->root[0], tree->size * NODE_SIZE);
new->root = buf_ptr; new->root = buf_ptr;
new->mem_alloc = tree->size *NODE_SIZE; new->mem_alloc = tree->size *NODE_SIZE;
return new; return new;

View File

@ -167,7 +167,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
X = (const md5_word_t *)data; X = (const md5_word_t *)data;
} else { } else {
/* not aligned */ /* not aligned */
memcpy(xbuf, data, 64); memmove(xbuf, data, 64);
X = xbuf; X = xbuf;
} }
} }
@ -353,7 +353,7 @@ md5_append(md5_state_t *pms, const md5_byte_t *data, unsigned int nbytes)
if (offset) { if (offset) {
unsigned int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); unsigned int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
memcpy(pms->buf + offset, p, copy); memmove(pms->buf + offset, p, copy);
if (offset + copy < 64) if (offset + copy < 64)
return; return;
p += copy; p += copy;
@ -367,7 +367,7 @@ md5_append(md5_state_t *pms, const md5_byte_t *data, unsigned int nbytes)
/* Process a final partial block. */ /* Process a final partial block. */
if (left) if (left)
memcpy(pms->buf, p, left); memmove(pms->buf, p, left);
} }
void void

View File

@ -114,7 +114,7 @@ typedef struct itrie_data {
YAP_Int i, new_num_buckets = DEPTH + BASE_TR_DATA_BUCKETS; \ YAP_Int i, new_num_buckets = DEPTH + BASE_TR_DATA_BUCKETS; \
bucket = TrEntry_buckets(TR_ENTRY); \ bucket = TrEntry_buckets(TR_ENTRY); \
new_itrie_buckets(TR_ENTRY, new_num_buckets); \ new_itrie_buckets(TR_ENTRY, new_num_buckets); \
memcpy(TrEntry_buckets(TR_ENTRY), bucket, \ memmove(TrEntry_buckets(TR_ENTRY), bucket, \
TrEntry_num_buckets(TR_ENTRY) * SIZEOF_TR_DATA_BUCKET); \ TrEntry_num_buckets(TR_ENTRY) * SIZEOF_TR_DATA_BUCKET); \
free_itrie_buckets(bucket, TrEntry_num_buckets(TR_ENTRY)); \ free_itrie_buckets(bucket, TrEntry_num_buckets(TR_ENTRY)); \
bucket = TrEntry_buckets(TR_ENTRY); \ bucket = TrEntry_buckets(TR_ENTRY); \

View File

@ -1468,12 +1468,12 @@ void traverse_and_print(TrNode node, int *arity, char *str, int str_index, int m
hash = (TrHash) node; hash = (TrHash) node;
first_bucket = TrHash_buckets(hash); first_bucket = TrHash_buckets(hash);
bucket = first_bucket + TrHash_num_buckets(hash); bucket = first_bucket + TrHash_num_buckets(hash);
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1)); memmove(current_arity, arity, sizeof(int) * (arity[0] + 1));
do { do {
if (*--bucket) { if (*--bucket) {
node = *bucket; node = *bucket;
traverse_and_print(node, arity, str, str_index, mode); traverse_and_print(node, arity, str, str_index, mode);
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1)); memmove(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
if (mode != TRIE_PRINT_FLOAT2 && arity[arity[0]] < 0) { if (mode != TRIE_PRINT_FLOAT2 && arity[arity[0]] < 0) {
/* restore possible PairEndEmptyTag/PairEndTermTag/CommaEndTag side-effect */ /* restore possible PairEndEmptyTag/PairEndTermTag/CommaEndTag side-effect */
if (str_index > 0 && str[str_index - 1] != '[') if (str_index > 0 && str[str_index - 1] != '[')
@ -1490,9 +1490,9 @@ void traverse_and_print(TrNode node, int *arity, char *str, int str_index, int m
if (TrNode_next(node)) { if (TrNode_next(node)) {
int *current_arity = (int *) malloc(sizeof(int) * (arity[0] + 1)); int *current_arity = (int *) malloc(sizeof(int) * (arity[0] + 1));
memcpy(current_arity, arity, sizeof(int) * (arity[0] + 1)); memmove(current_arity, arity, sizeof(int) * (arity[0] + 1));
traverse_and_print(TrNode_next(node), arity, str, str_index, mode); traverse_and_print(TrNode_next(node), arity, str, str_index, mode);
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1)); memmove(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
if (mode != TRIE_PRINT_FLOAT2 && arity[arity[0]] < 0) { if (mode != TRIE_PRINT_FLOAT2 && arity[arity[0]] < 0) {
/* restore possible PairEndEmptyTag/PairEndTermTag/CommaEndTag side-effect */ /* restore possible PairEndEmptyTag/PairEndTermTag/CommaEndTag side-effect */
if (str_index > 0 && str[str_index - 1] != '[') if (str_index > 0 && str[str_index - 1] != '[')

View File

@ -221,7 +221,7 @@ typedef struct trie_hash {
{ YAP_Term *aux_stack; \ { YAP_Term *aux_stack; \
YAP_Int aux_size = CURRENT_AUXILIARY_TERM_STACK_SIZE * sizeof(YAP_Term); \ YAP_Int aux_size = CURRENT_AUXILIARY_TERM_STACK_SIZE * sizeof(YAP_Term); \
new_struct(aux_stack, YAP_Term, aux_size * 2); \ new_struct(aux_stack, YAP_Term, aux_size * 2); \
memcpy(aux_stack, AUXILIARY_TERM_STACK, aux_size); \ memmove(aux_stack, AUXILIARY_TERM_STACK, aux_size); \
free_struct(AUXILIARY_TERM_STACK); \ free_struct(AUXILIARY_TERM_STACK); \
AUXILIARY_TERM_STACK = aux_stack; \ AUXILIARY_TERM_STACK = aux_stack; \
CURRENT_AUXILIARY_TERM_STACK_SIZE *= 2; \ CURRENT_AUXILIARY_TERM_STACK_SIZE *= 2; \

View File

@ -209,7 +209,7 @@ ExtendAliasArray(void)
UInt new_size = GLOBAL_SzOfFileAliases+ALIASES_BLOCK_SIZE; UInt new_size = GLOBAL_SzOfFileAliases+ALIASES_BLOCK_SIZE;
new = (AliasDesc)Yap_AllocCodeSpace(sizeof(AliasDesc *)*new_size); new = (AliasDesc)Yap_AllocCodeSpace(sizeof(AliasDesc *)*new_size);
memcpy((void *)new, (void *)GLOBAL_FileAliases, sizeof(AliasDesc *)*GLOBAL_SzOfFileAliases); memmove((void *)new, (void *)GLOBAL_FileAliases, sizeof(AliasDesc *)*GLOBAL_SzOfFileAliases);
Yap_FreeCodeSpace((ADDR) GLOBAL_FileAliases); Yap_FreeCodeSpace((ADDR) GLOBAL_FileAliases);
GLOBAL_FileAliases = new; GLOBAL_FileAliases = new;
GLOBAL_SzOfFileAliases = new_size; GLOBAL_SzOfFileAliases = new_size;

View File

@ -98,7 +98,7 @@ open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) {
if ((buf = AAsset_getBuffer(am))) { if ((buf = AAsset_getBuffer(am))) {
// copy to memory // copy to memory
char *bf = malloc(sz); char *bf = malloc(sz);
memcpy(bf, buf, sz); memmove(bf, buf, sz);
bool rc = Yap_set_stream_to_buf(st, bf, sz); bool rc = Yap_set_stream_to_buf(st, bf, sz);
if (rc) AAsset_close(am); if (rc) AAsset_close(am);
st->vfs = NULL; st->vfs = NULL;
@ -162,10 +162,10 @@ static bool stat_a(VFS_t *me, const char *fname, vfs_stat *out) {
out->st_dev = bf.st_dev; out->st_dev = bf.st_dev;
out->st_uid = bf.st_uid; out->st_uid = bf.st_uid;
out->st_gid = bf.st_gid; out->st_gid = bf.st_gid;
memcpy(&out->st_atimespec, (const void *) &bf.st_atim, sizeof(struct timespec)); memmove(&out->st_atimespec, (const void *) &bf.st_atim, sizeof(struct timespec));
memcpy(&out->st_mtimespec, (const void *) &bf.st_mtim, sizeof(struct timespec)); memmove(&out->st_mtimespec, (const void *) &bf.st_mtim, sizeof(struct timespec));
memcpy(&out->st_ctimespec, (const void *) &bf.st_ctim, sizeof(struct timespec)); memmove(&out->st_ctimespec, (const void *) &bf.st_ctim, sizeof(struct timespec));
memcpy(&out->st_birthtimespec, (const void *) &bf.st_ctim, memmove(&out->st_birthtimespec, (const void *) &bf.st_ctim,
sizeof(struct timespec)); sizeof(struct timespec));
} }
AAsset *a = AAssetManager_open(Yap_assetManager(), fname, AASSET_MODE_UNKNOWN); AAsset *a = AAssetManager_open(Yap_assetManager(), fname, AASSET_MODE_UNKNOWN);

View File

@ -98,7 +98,7 @@ static Int file_name_extension(USES_REGS1) {
ext = ""; ext = "";
} }
base = Malloc(lenb_b + 1); base = Malloc(lenb_b + 1);
memcpy(base, f, lenb_b); memmove(base, f, lenb_b);
base[lenb_b] = '\0'; base[lenb_b] = '\0';
if (IsVarTerm(t1 = Deref(ARG1))) { if (IsVarTerm(t1 = Deref(ARG1))) {
// should always succeed // should always succeed

View File

@ -96,7 +96,7 @@ fmemread(void *cookie, char *buf, int n)
return 0; return 0;
if (n >= c->eof - c->pos) if (n >= c->eof - c->pos)
n = c->eof - c->pos; n = c->eof - c->pos;
memcpy (buf, c->buf + c->pos, n); memmove (buf, c->buf + c->pos, n);
c->pos += n; c->pos += n;
return n; return n;
} }
@ -144,7 +144,7 @@ fmemwrite(void *cookie, const char *buf, int n)
} }
c->pos += n; c->pos += n;
if (n - adjust) if (n - adjust)
memcpy (c->buf + c->pos - n, buf, n - adjust); memmove (c->buf + c->pos - n, buf, n - adjust);
else else
{ {
return EOF; return EOF;

View File

@ -45,7 +45,7 @@ static int readfn(void *handler, char *buf, int size) {
if (size > available) { if (size > available) {
size = available; size = available;
} }
memcpy(buf, mem->buffer + mem->pos, sizeof(char) * size); memmove(buf, mem->buffer + mem->pos, sizeof(char) * size);
mem->pos += size; mem->pos += size;
return size; return size;
@ -58,7 +58,7 @@ static int writefn(void *handler, const char *buf, int size) {
if (size > available) { if (size > available) {
size = available; size = available;
} }
memcpy(mem->buffer + mem->pos, buf, sizeof(char) * size); memmove(mem->buffer + mem->pos, buf, sizeof(char) * size);
mem->pos += size; mem->pos += size;
return size; return size;

View File

@ -1130,7 +1130,9 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode,
Term file_name, encoding_t encoding, stream_flags_t flags, Term file_name, encoding_t encoding, stream_flags_t flags,
void *vfs) { void *vfs) {
StreamDesc *st = &GLOBAL_Stream[sno]; StreamDesc *st = &GLOBAL_Stream[sno];
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "init %s %s stream <%d>",io_mode,name, __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "init %s %s:%s stream <%d>",
io_mode, CurrentModule == 0? "prolog": RepAtom(AtomOfTerm(CurrentModule))->StrOfAE,
name,
sno); sno);
if (io_mode == NULL) if (io_mode == NULL)
Yap_Error(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, MkIntegerTerm(sno), Yap_Error(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, MkIntegerTerm(sno),

View File

@ -124,7 +124,6 @@ extern bool Yap_PrintWarning(Term twarning);
extern void Yap_plwrite(Term, struct stream_desc *, int, int, int); extern void Yap_plwrite(Term, struct stream_desc *, int, int, int);
extern void Yap_WriteAtom(struct stream_desc *s, Atom atom); extern void Yap_WriteAtom(struct stream_desc *s, Atom atom);
extern bool Yap_WriteTerm(int output_stream, Term t, Term opts USES_REGS); extern bool Yap_WriteTerm(int output_stream, Term t, Term opts USES_REGS);
extern Term Yap_scan_num(struct stream_desc *, bool); extern Term Yap_scan_num(struct stream_desc *, bool);
extern void Yap_DefaultStreamOps(StreamDesc *st); extern void Yap_DefaultStreamOps(StreamDesc *st);

View File

@ -85,7 +85,7 @@ mem_write (void *c, const char *buf, int n)
intermediate bytges are NUL. */ intermediate bytges are NUL. */
if (cookie->eof < cookie->pos) if (cookie->eof < cookie->pos)
memset (cbuf + cookie->eof, '\0', cookie->pos - cookie->eof); memset (cbuf + cookie->eof, '\0', cookie->pos - cookie->eof);
memcpy (cbuf + cookie->pos, buf, n); memmove (cbuf + cookie->pos, buf, n);
cookie->pos += n; cookie->pos += n;
/* If the user has previously written beyond the current position, /* If the user has previously written beyond the current position,
remember what the trailing NUL is overwriting. Otherwise, remember what the trailing NUL is overwriting. Otherwise,

View File

@ -202,7 +202,7 @@ void Yap_init_socks(char *host, long interface_port) {
soadr.sin_port = htons((short)interface_port); soadr.sin_port = htons((short)interface_port);
if (he != NULL) { if (he != NULL) {
memcpy((char *)&adr, (char *)he->h_addr_list[0], (size_t)he->h_length); memmove((char *)&adr, (char *)he->h_addr_list[0], (size_t)he->h_length);
} else { } else {
adr.s_addr = inet_addr(host); adr.s_addr = inet_addr(host);
} }
@ -635,7 +635,7 @@ static Int p_socket_bind(USES_REGS1) {
#endif #endif
return (FALSE); return (FALSE);
} }
memcpy((void *)&saddr.sin_addr, (void *)he->h_addr_list[0], he->h_length); memmove((void *)&saddr.sin_addr, (void *)he->h_addr_list[0], he->h_length);
} }
if (IsVarTerm(tport)) { if (IsVarTerm(tport)) {
port = 0; port = 0;
@ -774,7 +774,7 @@ static Int p_socket_connect(USES_REGS1) {
#endif #endif
return (FALSE); return (FALSE);
} }
memcpy((void *)&saddr.sin_addr, (void *)he->h_addr_list[0], he->h_length); memmove((void *)&saddr.sin_addr, (void *)he->h_addr_list[0], he->h_length);
} }
if (IsVarTerm(tport)) { if (IsVarTerm(tport)) {
Yap_Error(INSTANTIATION_ERROR, tport, "socket_connect/3"); Yap_Error(INSTANTIATION_ERROR, tport, "socket_connect/3");
@ -1239,7 +1239,7 @@ static Int p_hostname_address(USES_REGS1) {
#endif #endif
return false; return false;
} }
memcpy((char *)&adr, (char *)he->h_addr_list[0], (size_t)he->h_length); memmove((char *)&adr, (char *)he->h_addr_list[0], (size_t)he->h_length);
out = MkAtomTerm(Yap_LookupAtom(inet_ntoa(adr))); out = MkAtomTerm(Yap_LookupAtom(inet_ntoa(adr)));
return (Yap_unify(out, ARG2)); return (Yap_unify(out, ARG2));
} }

View File

@ -80,7 +80,7 @@ int bpredscpu(int *dop1, int rows, int *bin, int3 numpreds, int **ret)
ptr = fres; ptr = fres;
for(x = 0; x < NUM_T; x++) for(x = 0; x < NUM_T; x++)
{ {
memcpy(ptr, vec[x].data(), ini[x] * sizeof(int)); memmove(ptr, vec[x].data(), ini[x] * sizeof(int));
ptr += ini[x]; ptr += ini[x];
} }
*ret = fres; *ret = fres;

View File

@ -376,12 +376,12 @@ load_rule( void ) {
pred->is_fact = FALSE; pred->is_fact = FALSE;
x = (strlen(strname) + 1) * sizeof(char); x = (strlen(strname) + 1) * sizeof(char);
pred->predname = (char *)malloc(x); pred->predname = (char *)malloc(x);
memcpy(pred->predname, strname, x); memmove(pred->predname, strname, x);
nvec = (int32_t *)malloc(sizeof(int32_t)*(ptr-vec)); nvec = (int32_t *)malloc(sizeof(int32_t)*(ptr-vec));
memcpy(nvec, vec, sizeof(int32_t)*(ptr-vec)); memmove(nvec, vec, sizeof(int32_t)*(ptr-vec));
pred->address_host_table = nvec; pred->address_host_table = nvec;
pred->negatives = (int32_t *)malloc(sizeof(int32_t) * cont); pred->negatives = (int32_t *)malloc(sizeof(int32_t) * cont);
memcpy(pred->negatives, neg, sizeof(int32_t) * cont); memmove(pred->negatives, neg, sizeof(int32_t) * cont);
Cuda_NewRule( pred ); Cuda_NewRule( pred );
return YAP_Unify(YAP_ARG4, YAP_MkIntTerm((YAP_Int)pred)); return YAP_Unify(YAP_ARG4, YAP_MkIntTerm((YAP_Int)pred));
} }

View File

@ -180,7 +180,7 @@ void postgresRead(PGconn **ret, vector<gpunode> *L, int *inpquery, char *names,
{ {
numt = (strlen(tok) + 1) * sizeof(char); numt = (strlen(tok) + 1) * sizeof(char);
qrs[x] = (char *)malloc(numt); qrs[x] = (char *)malloc(numt);
memcpy(qrs[x], tok, numt); memmove(qrs[x], tok, numt);
} }
x += 2; x += 2;
} }
@ -264,7 +264,7 @@ void postgresRead(PGconn **ret, vector<gpunode> *L, int *inpquery, char *names,
L->at(z).address_host_table = mat; L->at(z).address_host_table = mat;
numc = (strlen(tok) + 1) * sizeof(char); numc = (strlen(tok) + 1) * sizeof(char);
L->at(z).predname = (char *)malloc(numc); L->at(z).predname = (char *)malloc(numc);
memcpy(L->at(z).predname, tok, numc); memmove(L->at(z).predname, tok, numc);
PQclear(pgr); PQclear(pgr);
tok = strtok(NULL, " "); tok = strtok(NULL, " ");
z++; z++;

View File

@ -466,7 +466,7 @@ int joincpu(int *p1, int *p2, int rLen, int sLen, int of1, int of2, list<rulenod
temp = fres; temp = fres;
for(x = 0; x < NUM_T; x++) for(x = 0; x < NUM_T; x++)
{ {
memcpy(temp, res[x].data(), ini[x] * sizeof(int)); memmove(temp, res[x].data(), ini[x] * sizeof(int));
temp += ini[x]; temp += ini[x];
} }

View File

@ -114,7 +114,7 @@ void movebpreds(InputIterator rules, InputIterator end)
subs = rules->rule_names[x+1] - rules->rule_names[x]; subs = rules->rule_names[x+1] - rules->rule_names[x];
if(rules->address_host_table[rules->rule_names[x]] > 0) if(rules->address_host_table[rules->rule_names[x]] > 0)
{ {
memcpy(rest + cont, rules->address_host_table + rules->rule_names[x], subs * sizeof(int)); memmove(rest + cont, rules->address_host_table + rules->rule_names[x], subs * sizeof(int));
cont += subs; cont += subs;
} }
else else
@ -123,17 +123,17 @@ void movebpreds(InputIterator rules, InputIterator end)
subs--; subs--;
if(rules->address_host_table[pos] > 0 && rules->address_host_table[pos+1] > 0) if(rules->address_host_table[pos] > 0 && rules->address_host_table[pos+1] > 0)
{ {
memcpy(move2 + cont3, rules->address_host_table + rules->rule_names[x], subs * sizeof(int)); memmove(move2 + cont3, rules->address_host_table + rules->rule_names[x], subs * sizeof(int));
cont3 += subs; cont3 += subs;
} }
else else
{ {
memcpy(move + cont2, rules->address_host_table + rules->rule_names[x], subs * sizeof(int)); memmove(move + cont2, rules->address_host_table + rules->rule_names[x], subs * sizeof(int));
cont2 += subs; cont2 += subs;
} }
} }
} }
memcpy(rules->address_host_table, rest, cont * sizeof(int)); memmove(rules->address_host_table, rest, cont * sizeof(int));
pos = 1; pos = 1;
for(x = 1; x <= total; x++) for(x = 1; x <= total; x++)
@ -178,7 +178,7 @@ void movebpreds(InputIterator rules, InputIterator end)
pos += 2; pos += 2;
cont = closestpred(rules->rule_names, rules->num_rows, p1); cont = closestpred(rules->rule_names, rules->num_rows, p1);
memcpy(rules->preds[cont] + rules->numpreds[cont].x, move + cont2, total); memmove(rules->preds[cont] + rules->numpreds[cont].x, move + cont2, total);
rules->numpreds[cont].x += 3; rules->numpreds[cont].x += 3;
cont2 += 3; cont2 += 3;
} }
@ -212,19 +212,19 @@ void movebpreds(InputIterator rules, InputIterator end)
cont2 = closestpred(rules->rule_names, rules->num_rows, p2); cont2 = closestpred(rules->rule_names, rules->num_rows, p2);
if(cont == cont2) if(cont == cont2)
{ {
memcpy(rules->preds[cont] + rules->numpreds[cont].x, move2 + cont3, total); memmove(rules->preds[cont] + rules->numpreds[cont].x, move2 + cont3, total);
rules->numpreds[cont].x += 3; rules->numpreds[cont].x += 3;
} }
else else
{ {
if(cont > cont2) if(cont > cont2)
{ {
memcpy(rules->preds[cont] + rules->numpreds[cont].x + rules->numpreds[cont].y, move2 + cont3, total); memmove(rules->preds[cont] + rules->numpreds[cont].x + rules->numpreds[cont].y, move2 + cont3, total);
rules->numpreds[cont].y += 3; rules->numpreds[cont].y += 3;
} }
else else
{ {
memcpy(rules->preds[cont2] + rules->numpreds[cont2].x + rules->numpreds[cont2].y, move2 + cont3, total); memmove(rules->preds[cont2] + rules->numpreds[cont2].x + rules->numpreds[cont2].y, move2 + cont3, total);
rules->numpreds[cont2].y += 3; rules->numpreds[cont2].y += 3;
} }
} }
@ -345,7 +345,7 @@ void seleccion(InputIterator actual, InputIterator end)
sl = x - 1; sl = x - 1;
tam = cont * sizeof(int); tam = cont * sizeof(int);
actual->select[sl] = (int *)malloc(tam); actual->select[sl] = (int *)malloc(tam);
memcpy(actual->select[sl], pv, tam); memmove(actual->select[sl], pv, tam);
actual->numsel[sl] = cont; actual->numsel[sl] = cont;
} }
actual++; actual++;
@ -480,9 +480,9 @@ int2 columnsproject(int *first, int tam, int *rule, int ini, int fin, int sini,
temp = ret.y * sizeof(int); temp = ret.y * sizeof(int);
free(*newrule); free(*newrule);
*newrule = (int *)malloc(temp); *newrule = (int *)malloc(temp);
memcpy(*newrule, pv, temp); memmove(*newrule, pv, temp);
*res = (int *)malloc(temp); *res = (int *)malloc(temp);
memcpy(*res, pv2, temp); memmove(*res, pv2, temp);
return ret; return ret;
} }
@ -509,7 +509,7 @@ int wherejoin(int *tmprule, int tmplen, int *rule, int tam2, int **res)
temp = cont * sizeof(int); temp = cont * sizeof(int);
*res = (int *)malloc(temp); *res = (int *)malloc(temp);
memcpy(*res, joins, temp); memmove(*res, joins, temp);
return cont; return cont;
} }
@ -611,7 +611,7 @@ void proyeccion(InputIterator actual, InputIterator end)
temp = pos.x * sizeof(int); temp = pos.x * sizeof(int);
actual->project[0] = (int *)malloc(temp); actual->project[0] = (int *)malloc(temp);
memcpy(actual->project[0], fjoin, temp); memmove(actual->project[0], fjoin, temp);
pos.y = pos.x; pos.y = pos.x;
actual->projpos[0] = pos; actual->projpos[0] = pos;
actual++; actual++;
@ -628,7 +628,7 @@ void proyeccion(InputIterator actual, InputIterator end)
pos.y = actual->rule_names[2] - actual->rule_names[1] - 2; pos.y = actual->rule_names[2] - actual->rule_names[1] - 2;
temp = pos.y * sizeof(int); temp = pos.y * sizeof(int);
pv = (int *)malloc(temp); pv = (int *)malloc(temp);
memcpy(pv, actual->address_host_table + actual->rule_names[1] + 1, temp); memmove(pv, actual->address_host_table + actual->rule_names[1] + 1, temp);
for(x = 2, y = 0; x <= numjoins; x++, y++) for(x = 2, y = 0; x <= numjoins; x++, y++)
{ {
@ -676,7 +676,7 @@ void proyeccion(InputIterator actual, InputIterator end)
} }
temp = pos.x * sizeof(int); temp = pos.x * sizeof(int);
actual->project[numjoins] = (int *)malloc(temp); actual->project[numjoins] = (int *)malloc(temp);
memcpy(actual->project[numjoins], fjoin, temp); memmove(actual->project[numjoins], fjoin, temp);
pos.y = pos.x; pos.y = pos.x;
actual->projpos[numjoins] = pos; actual->projpos[numjoins] = pos;
actual++; actual++;
@ -701,7 +701,7 @@ void selfjoin(InputIterator actual, InputIterator end)
if(actual->address_host_table[pos] < 0) if(actual->address_host_table[pos] < 0)
continue; continue;
tam = actual->rule_names[x+1] - actual->rule_names[x] - 2; tam = actual->rule_names[x+1] - actual->rule_names[x] - 2;
memcpy(rulecpy, actual->address_host_table + pos + 1, tam * sizeof(int)); memmove(rulecpy, actual->address_host_table + pos + 1, tam * sizeof(int));
cont = 0; cont = 0;
for(y = 0; y < tam; y++) for(y = 0; y < tam; y++)
{ {
@ -735,7 +735,7 @@ void selfjoin(InputIterator actual, InputIterator end)
temp = x - 1; temp = x - 1;
tam = cont * sizeof(int); tam = cont * sizeof(int);
actual->selfjoin[temp] = (int *)malloc(tam); actual->selfjoin[temp] = (int *)malloc(tam);
memcpy(actual->selfjoin[temp], fjoin, tam); memmove(actual->selfjoin[temp], fjoin, tam);
actual->numselfj[temp] = cont; actual->numselfj[temp] = cont;
} }
actual++; actual++;
@ -772,7 +772,7 @@ void consulta(int *query, int qsize, int qname, rulenode *res)
size = cont1 * sizeof(int); size = cont1 * sizeof(int);
res->select = (int **)malloc(sizeof(int *)); res->select = (int **)malloc(sizeof(int *));
res->select[0] = (int *)malloc(size); res->select[0] = (int *)malloc(size);
memcpy(res->select[0], sel, size); memmove(res->select[0], sel, size);
cont1 = 0; cont1 = 0;
} }
if(cont2 > 0) if(cont2 > 0)
@ -780,7 +780,7 @@ void consulta(int *query, int qsize, int qname, rulenode *res)
size = cont2 * sizeof(int); size = cont2 * sizeof(int);
res->project = (int **)malloc(sizeof(int *)); res->project = (int **)malloc(sizeof(int *));
res->project[0] = (int *)malloc(size); res->project[0] = (int *)malloc(size);
memcpy(res->project[0], pro, size); memmove(res->project[0], pro, size);
} }
for(x = 0; x < qsize; x++) for(x = 0; x < qsize; x++)
{ {
@ -817,7 +817,7 @@ void consulta(int *query, int qsize, int qname, rulenode *res)
size = cont1 * sizeof(int); size = cont1 * sizeof(int);
res->selfjoin = (int **)malloc(sizeof(int *)); res->selfjoin = (int **)malloc(sizeof(int *));
res->selfjoin[0] = (int *)malloc(size); res->selfjoin[0] = (int *)malloc(size);
memcpy(res->selfjoin[0], sel, size); memmove(res->selfjoin[0], sel, size);
} }
} }

View File

@ -346,7 +346,7 @@ int cargarcpu(int name, int num_rows, int num_columns, int is_fact, int *address
} }
for(; x < numcpu; x++) for(; x < numcpu; x++)
{ {
memcpy(temp + inc, temp_storage[x].dev_address, temp_storage[x].size); memmove(temp + inc, temp_storage[x].dev_address, temp_storage[x].size);
inc += temp_storage[x].size / sizeof(int); inc += temp_storage[x].size / sizeof(int);
free(temp_storage[x].dev_address); free(temp_storage[x].dev_address);
} }

View File

@ -376,12 +376,12 @@ load_rule( void ) {
pred->is_fact = FALSE; pred->is_fact = FALSE;
x = (strlen(strname) + 1) * sizeof(char); x = (strlen(strname) + 1) * sizeof(char);
pred->predname = (char *)malloc(x); pred->predname = (char *)malloc(x);
memcpy(pred->predname, strname, x); memmove(pred->predname, strname, x);
nvec = (int32_t *)malloc(sizeof(int32_t)*(ptr-vec)); nvec = (int32_t *)malloc(sizeof(int32_t)*(ptr-vec));
memcpy(nvec, vec, sizeof(int32_t)*(ptr-vec)); memmove(nvec, vec, sizeof(int32_t)*(ptr-vec));
pred->address_host_table = nvec; pred->address_host_table = nvec;
pred->negatives = (int32_t *)malloc(sizeof(int32_t) * cont); pred->negatives = (int32_t *)malloc(sizeof(int32_t) * cont);
memcpy(pred->negatives, neg, sizeof(int32_t) * cont); memmove(pred->negatives, neg, sizeof(int32_t) * cont);
Cuda_NewRule( pred ); Cuda_NewRule( pred );
return YAP_Unify(YAP_ARG4, YAP_MkIntTerm((YAP_Int)pred)); return YAP_Unify(YAP_ARG4, YAP_MkIntTerm((YAP_Int)pred));
} }

View File

@ -180,7 +180,7 @@ void postgresRead(PGconn **ret, vector<gpunode> *L, int *inpquery, char *names,
{ {
numt = (strlen(tok) + 1) * sizeof(char); numt = (strlen(tok) + 1) * sizeof(char);
qrs[x] = (char *)malloc(numt); qrs[x] = (char *)malloc(numt);
memcpy(qrs[x], tok, numt); memmove(qrs[x], tok, numt);
} }
x += 2; x += 2;
} }
@ -264,7 +264,7 @@ void postgresRead(PGconn **ret, vector<gpunode> *L, int *inpquery, char *names,
L->at(z).address_host_table = mat; L->at(z).address_host_table = mat;
numc = (strlen(tok) + 1) * sizeof(char); numc = (strlen(tok) + 1) * sizeof(char);
L->at(z).predname = (char *)malloc(numc); L->at(z).predname = (char *)malloc(numc);
memcpy(L->at(z).predname, tok, numc); memmove(L->at(z).predname, tok, numc);
PQclear(pgr); PQclear(pgr);
tok = strtok(NULL, " "); tok = strtok(NULL, " ");
z++; z++;

View File

@ -114,7 +114,7 @@ void movebpreds(InputIterator rules, InputIterator end)
subs = rules->rule_names[x+1] - rules->rule_names[x]; subs = rules->rule_names[x+1] - rules->rule_names[x];
if(rules->address_host_table[rules->rule_names[x]] > 0) if(rules->address_host_table[rules->rule_names[x]] > 0)
{ {
memcpy(rest + cont, rules->address_host_table + rules->rule_names[x], subs * sizeof(int)); memmove(rest + cont, rules->address_host_table + rules->rule_names[x], subs * sizeof(int));
cont += subs; cont += subs;
} }
else else
@ -123,17 +123,17 @@ void movebpreds(InputIterator rules, InputIterator end)
subs--; subs--;
if(rules->address_host_table[pos] > 0 && rules->address_host_table[pos+1] > 0) if(rules->address_host_table[pos] > 0 && rules->address_host_table[pos+1] > 0)
{ {
memcpy(move2 + cont3, rules->address_host_table + rules->rule_names[x], subs * sizeof(int)); memmove(move2 + cont3, rules->address_host_table + rules->rule_names[x], subs * sizeof(int));
cont3 += subs; cont3 += subs;
} }
else else
{ {
memcpy(move + cont2, rules->address_host_table + rules->rule_names[x], subs * sizeof(int)); memmove(move + cont2, rules->address_host_table + rules->rule_names[x], subs * sizeof(int));
cont2 += subs; cont2 += subs;
} }
} }
} }
memcpy(rules->address_host_table, rest, cont * sizeof(int)); memmove(rules->address_host_table, rest, cont * sizeof(int));
pos = 1; pos = 1;
for(x = 1; x <= total; x++) for(x = 1; x <= total; x++)
@ -178,7 +178,7 @@ void movebpreds(InputIterator rules, InputIterator end)
pos += 2; pos += 2;
cont = closestpred(rules->rule_names, rules->num_rows, p1); cont = closestpred(rules->rule_names, rules->num_rows, p1);
memcpy(rules->preds[cont] + rules->numpreds[cont].x, move + cont2, total); memmove(rules->preds[cont] + rules->numpreds[cont].x, move + cont2, total);
rules->numpreds[cont].x += 3; rules->numpreds[cont].x += 3;
cont2 += 3; cont2 += 3;
} }
@ -212,19 +212,19 @@ void movebpreds(InputIterator rules, InputIterator end)
cont2 = closestpred(rules->rule_names, rules->num_rows, p2); cont2 = closestpred(rules->rule_names, rules->num_rows, p2);
if(cont == cont2) if(cont == cont2)
{ {
memcpy(rules->preds[cont] + rules->numpreds[cont].x, move2 + cont3, total); memmove(rules->preds[cont] + rules->numpreds[cont].x, move2 + cont3, total);
rules->numpreds[cont].x += 3; rules->numpreds[cont].x += 3;
} }
else else
{ {
if(cont > cont2) if(cont > cont2)
{ {
memcpy(rules->preds[cont] + rules->numpreds[cont].x + rules->numpreds[cont].y, move2 + cont3, total); memmove(rules->preds[cont] + rules->numpreds[cont].x + rules->numpreds[cont].y, move2 + cont3, total);
rules->numpreds[cont].y += 3; rules->numpreds[cont].y += 3;
} }
else else
{ {
memcpy(rules->preds[cont2] + rules->numpreds[cont2].x + rules->numpreds[cont2].y, move2 + cont3, total); memmove(rules->preds[cont2] + rules->numpreds[cont2].x + rules->numpreds[cont2].y, move2 + cont3, total);
rules->numpreds[cont2].y += 3; rules->numpreds[cont2].y += 3;
} }
} }
@ -345,7 +345,7 @@ void seleccion(InputIterator actual, InputIterator end)
sl = x - 1; sl = x - 1;
tam = cont * sizeof(int); tam = cont * sizeof(int);
actual->select[sl] = (int *)malloc(tam); actual->select[sl] = (int *)malloc(tam);
memcpy(actual->select[sl], pv, tam); memmove(actual->select[sl], pv, tam);
actual->numsel[sl] = cont; actual->numsel[sl] = cont;
} }
actual++; actual++;
@ -480,9 +480,9 @@ int2 columnsproject(int *first, int tam, int *rule, int ini, int fin, int sini,
temp = ret.y * sizeof(int); temp = ret.y * sizeof(int);
free(*newrule); free(*newrule);
*newrule = (int *)malloc(temp); *newrule = (int *)malloc(temp);
memcpy(*newrule, pv, temp); memmove(*newrule, pv, temp);
*res = (int *)malloc(temp); *res = (int *)malloc(temp);
memcpy(*res, pv2, temp); memmove(*res, pv2, temp);
return ret; return ret;
} }
@ -509,7 +509,7 @@ int wherejoin(int *tmprule, int tmplen, int *rule, int tam2, int **res)
temp = cont * sizeof(int); temp = cont * sizeof(int);
*res = (int *)malloc(temp); *res = (int *)malloc(temp);
memcpy(*res, joins, temp); memmove(*res, joins, temp);
return cont; return cont;
} }
@ -611,7 +611,7 @@ void proyeccion(InputIterator actual, InputIterator end)
temp = pos.x * sizeof(int); temp = pos.x * sizeof(int);
actual->project[0] = (int *)malloc(temp); actual->project[0] = (int *)malloc(temp);
memcpy(actual->project[0], fjoin, temp); memmove(actual->project[0], fjoin, temp);
pos.y = pos.x; pos.y = pos.x;
actual->projpos[0] = pos; actual->projpos[0] = pos;
actual++; actual++;
@ -628,7 +628,7 @@ void proyeccion(InputIterator actual, InputIterator end)
pos.y = actual->rule_names[2] - actual->rule_names[1] - 2; pos.y = actual->rule_names[2] - actual->rule_names[1] - 2;
temp = pos.y * sizeof(int); temp = pos.y * sizeof(int);
pv = (int *)malloc(temp); pv = (int *)malloc(temp);
memcpy(pv, actual->address_host_table + actual->rule_names[1] + 1, temp); memmove(pv, actual->address_host_table + actual->rule_names[1] + 1, temp);
for(x = 2, y = 0; x <= numjoins; x++, y++) for(x = 2, y = 0; x <= numjoins; x++, y++)
{ {
@ -676,7 +676,7 @@ void proyeccion(InputIterator actual, InputIterator end)
} }
temp = pos.x * sizeof(int); temp = pos.x * sizeof(int);
actual->project[numjoins] = (int *)malloc(temp); actual->project[numjoins] = (int *)malloc(temp);
memcpy(actual->project[numjoins], fjoin, temp); memmove(actual->project[numjoins], fjoin, temp);
pos.y = pos.x; pos.y = pos.x;
actual->projpos[numjoins] = pos; actual->projpos[numjoins] = pos;
actual++; actual++;
@ -701,7 +701,7 @@ void selfjoin(InputIterator actual, InputIterator end)
if(actual->address_host_table[pos] < 0) if(actual->address_host_table[pos] < 0)
continue; continue;
tam = actual->rule_names[x+1] - actual->rule_names[x] - 2; tam = actual->rule_names[x+1] - actual->rule_names[x] - 2;
memcpy(rulecpy, actual->address_host_table + pos + 1, tam * sizeof(int)); memmove(rulecpy, actual->address_host_table + pos + 1, tam * sizeof(int));
cont = 0; cont = 0;
for(y = 0; y < tam; y++) for(y = 0; y < tam; y++)
{ {
@ -735,7 +735,7 @@ void selfjoin(InputIterator actual, InputIterator end)
temp = x - 1; temp = x - 1;
tam = cont * sizeof(int); tam = cont * sizeof(int);
actual->selfjoin[temp] = (int *)malloc(tam); actual->selfjoin[temp] = (int *)malloc(tam);
memcpy(actual->selfjoin[temp], fjoin, tam); memmove(actual->selfjoin[temp], fjoin, tam);
actual->numselfj[temp] = cont; actual->numselfj[temp] = cont;
} }
actual++; actual++;
@ -772,7 +772,7 @@ void consulta(int *query, int qsize, int qname, rulenode *res)
size = cont1 * sizeof(int); size = cont1 * sizeof(int);
res->select = (int **)malloc(sizeof(int *)); res->select = (int **)malloc(sizeof(int *));
res->select[0] = (int *)malloc(size); res->select[0] = (int *)malloc(size);
memcpy(res->select[0], sel, size); memmove(res->select[0], sel, size);
cont1 = 0; cont1 = 0;
} }
if(cont2 > 0) if(cont2 > 0)
@ -780,7 +780,7 @@ void consulta(int *query, int qsize, int qname, rulenode *res)
size = cont2 * sizeof(int); size = cont2 * sizeof(int);
res->project = (int **)malloc(sizeof(int *)); res->project = (int **)malloc(sizeof(int *));
res->project[0] = (int *)malloc(size); res->project[0] = (int *)malloc(size);
memcpy(res->project[0], pro, size); memmove(res->project[0], pro, size);
} }
for(x = 0; x < qsize; x++) for(x = 0; x < qsize; x++)
{ {
@ -817,7 +817,7 @@ void consulta(int *query, int qsize, int qname, rulenode *res)
size = cont1 * sizeof(int); size = cont1 * sizeof(int);
res->selfjoin = (int **)malloc(sizeof(int *)); res->selfjoin = (int **)malloc(sizeof(int *));
res->selfjoin[0] = (int *)malloc(size); res->selfjoin[0] = (int *)malloc(size);
memcpy(res->selfjoin[0], sel, size); memmove(res->selfjoin[0], sel, size);
} }
} }

View File

@ -346,7 +346,7 @@ int cargarcpu(int name, int num_rows, int num_columns, int is_fact, int *address
} }
for(; x < numcpu; x++) for(; x < numcpu; x++)
{ {
memcpy(temp + inc, temp_storage[x].dev_address, temp_storage[x].size); memmove(temp + inc, temp_storage[x].dev_address, temp_storage[x].size);
inc += temp_storage[x].size / sizeof(int); inc += temp_storage[x].size / sizeof(int);
free(temp_storage[x].dev_address); free(temp_storage[x].dev_address);
} }

View File

@ -117,7 +117,7 @@ int selectproyectcpu(int *dop1, int rows, int cols, int head_size, int *select,
ptr = fres; ptr = fres;
for(x = 0; x < NUM_T; x++) for(x = 0; x < NUM_T; x++)
{ {
memcpy(ptr, vec[x].data(), ini[x] * sizeof(int)); memmove(ptr, vec[x].data(), ini[x] * sizeof(int));
ptr += ini[x]; ptr += ini[x];
} }
*ret = fres; *ret = fres;
@ -237,7 +237,7 @@ int selectproyectcpu2(int *dop1, int rows, int cols, int *select, int numselect,
ptr = lres; ptr = lres;
for(x = 0; x < NUM_T; x++) for(x = 0; x < NUM_T; x++)
{ {
memcpy(ptr, lis[x], cont[x] * sizeof(int)); memmove(ptr, lis[x], cont[x] * sizeof(int));
ptr += cont[x]; ptr += cont[x];
} }
if(list != NULL) if(list != NULL)
@ -246,7 +246,7 @@ int selectproyectcpu2(int *dop1, int rows, int cols, int *select, int numselect,
ptr = fres; ptr = fres;
for(x = 0; x < NUM_T; x++) for(x = 0; x < NUM_T; x++)
{ {
memcpy(ptr, vec[x], cont[x] * sizeof(int)); memmove(ptr, vec[x], cont[x] * sizeof(int));
ptr += cont[x]; ptr += cont[x];
} }
*ret = fres; *ret = fres;
@ -373,7 +373,7 @@ int selectproyectcpu3(int *dop1, int rows, int cols, int *select, int numselect,
ptr = lres; ptr = lres;
for(x = 0; x < NUM_T; x++) for(x = 0; x < NUM_T; x++)
{ {
memcpy(ptr, lis[x].data(), ini[x] * sizeof(int)); memmove(ptr, lis[x].data(), ini[x] * sizeof(int));
ptr += ini[x]; ptr += ini[x];
} }
if(list != NULL) if(list != NULL)
@ -382,7 +382,7 @@ int selectproyectcpu3(int *dop1, int rows, int cols, int *select, int numselect,
ptr = fres; ptr = fres;
for(x = 0; x < NUM_T; x++) for(x = 0; x < NUM_T; x++)
{ {
memcpy(ptr, vec[x].data(), ini[x] * sizeof(int)); memmove(ptr, vec[x].data(), ini[x] * sizeof(int));
ptr += ini[x]; ptr += ini[x];
} }
*ret = fres; *ret = fres;

View File

@ -25,7 +25,7 @@ int unircpu(int *res, int rows, int tipo, int **ret)
{ {
size = nrows * tipo * sizeof(int); size = nrows * tipo * sizeof(int);
nres = (int *)malloc(size); nres = (int *)malloc(size);
memcpy(nres, res, size); memmove(nres, res, size);
free(*ret); free(*ret);
*ret = nres; *ret = nres;
}*/ }*/
@ -41,7 +41,7 @@ int unircpu(int *res, int rows, int tipo, int **ret)
{ {
size = nrows * tipo * sizeof(int); size = nrows * tipo * sizeof(int);
nres = (int *)malloc(size); nres = (int *)malloc(size);
memcpy(nres, res, size); memmove(nres, res, size);
free(*ret); free(*ret);
*ret = nres; *ret = nres;
}*/ }*/
@ -57,7 +57,7 @@ int unircpu(int *res, int rows, int tipo, int **ret)
{ {
size = nrows * tipo * sizeof(int); size = nrows * tipo * sizeof(int);
nres = (int *)malloc(size); nres = (int *)malloc(size);
memcpy(nres, res, size); memmove(nres, res, size);
free(*ret); free(*ret);
*ret = nres; *ret = nres;
}*/ }*/

View File

@ -168,6 +168,7 @@
:- use_module(myddas_errors,[ :- use_module(myddas_errors,[
'$error_checks'/1 '$error_checks'/1
]). ]).
:- use_module(myddas_prolog2sql,[ :- use_module(myddas_prolog2sql,[

View File

@ -595,7 +595,7 @@ static Int c_sqlite3_row(USES_REGS1) {
size_t bytes = sqlite3_column_bytes(res_set->stmt, i); size_t bytes = sqlite3_column_bytes(res_set->stmt, i);
void *pt; void *pt;
tf = Yap_AllocExternalDataInStack(EXTERNAL_BLOB, bytes, &pt); tf = Yap_AllocExternalDataInStack(EXTERNAL_BLOB, bytes, &pt);
memcpy(pt, sqlite3_column_blob(res_set->stmt, i), bytes); memmove(pt, sqlite3_column_blob(res_set->stmt, i), bytes);
} break; } break;
case SQLITE_NULL: case SQLITE_NULL:
null_atom[0] = MkIntegerTerm(null_id++); null_atom[0] = MkIntegerTerm(null_id++);

View File

@ -16,7 +16,6 @@ main_ .
init :- init :-
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _), db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
% db_open(sqlite3, 'chinook.db', _, _), % db_open(sqlite3, 'chinook.db', _, _),
writeln('chinook has landed'). writeln('chinook has landed').
@ -75,7 +74,7 @@ go :-
go_cut1. go_cut1.
go :- go :-
X=1, % X=1,
artists(X,Y), artists(X,Y),
writeln(X:Y). writeln(X:Y).
@ -86,7 +85,7 @@ go_cut0 :-
go_cut1 :- go_cut1 :-
X=1, % X=1,
artists(X,Y), artists(X,Y),
writeln(X:Y), writeln(X:Y),
!. !.
@ -94,5 +93,6 @@ go_cut1 :-
close :- close :-
db_close. db_close.
:- main.
:- stop_low_level_trace.
:- initialization(main).

File diff suppressed because it is too large Load Diff

View File

@ -186,7 +186,7 @@ int pc_mpm_alloc_occ_switches_0(void)
occ_switches = MALLOC(sizeof(SW_INS_PTR) * sw_tab_size); occ_switches = MALLOC(sizeof(SW_INS_PTR) * sw_tab_size);
occ_switch_tab_size = sw_tab_size; occ_switch_tab_size = sw_tab_size;
memcpy(occ_switches, switches, sizeof(SW_INS_PTR) * sw_tab_size); memmove(occ_switches, switches, sizeof(SW_INS_PTR) * sw_tab_size);
if (fix_init_order) { if (fix_init_order) {
sort_occ_switches(); sort_occ_switches();
} }

View File

@ -146,7 +146,7 @@ static bool getLine(StreamDesc *rl_iostream, int sno) {
size_t size = strlen (myrl_line)+1; size_t size = strlen (myrl_line)+1;
rl_iostream->u.irl.ptr = rl_iostream->u.irl.buf = rl_iostream->u.irl.ptr = rl_iostream->u.irl.buf =
(const unsigned char *)malloc(size); (const unsigned char *)malloc(size);
memcpy((void *)rl_iostream->u.irl.buf, myrl_line, size); memmove((void *)rl_iostream->u.irl.buf, myrl_line, size);
return true; return true;
} }

View File

@ -95,7 +95,7 @@ typedef struct {
#define utarray_push_back(a,p) do { \ #define utarray_push_back(a,p) do { \
utarray_reserve(a,1); \ utarray_reserve(a,1); \
if ((a)->icd.copy) { (a)->icd.copy( _utarray_eltptr(a,(a)->i++), p); } \ if ((a)->icd.copy) { (a)->icd.copy( _utarray_eltptr(a,(a)->i++), p); } \
else { memcpy(_utarray_eltptr(a,(a)->i++), p, (a)->icd.sz); }; \ else { memmove(_utarray_eltptr(a,(a)->i++), p, (a)->icd.sz); }; \
} while(0) } while(0)
#define utarray_pop_back(a) do { \ #define utarray_pop_back(a) do { \
@ -123,7 +123,7 @@ typedef struct {
((a)->i - (j))*((a)->icd.sz)); \ ((a)->i - (j))*((a)->icd.sz)); \
} \ } \
if ((a)->icd.copy) { (a)->icd.copy( _utarray_eltptr(a,j), p); } \ if ((a)->icd.copy) { (a)->icd.copy( _utarray_eltptr(a,j), p); } \
else { memcpy(_utarray_eltptr(a,j), p, (a)->icd.sz); }; \ else { memmove(_utarray_eltptr(a,j), p, (a)->icd.sz); }; \
(a)->i++; \ (a)->i++; \
} while(0) } while(0)
@ -142,7 +142,7 @@ typedef struct {
(a)->icd.copy(_utarray_eltptr(a,j+_ut_i), _utarray_eltptr(w,_ut_i)); \ (a)->icd.copy(_utarray_eltptr(a,j+_ut_i), _utarray_eltptr(w,_ut_i)); \
} \ } \
} else { \ } else { \
memcpy(_utarray_eltptr(a,j), _utarray_eltptr(w,0), \ memmove(_utarray_eltptr(a,j), _utarray_eltptr(w,0), \
utarray_len(w)*((a)->icd.sz)); \ utarray_len(w)*((a)->icd.sz)); \
} \ } \
(a)->i += utarray_len(w); \ (a)->i += utarray_len(w); \

View File

@ -239,7 +239,7 @@ void lbfgs_free(lbfgsfloatval_t *x)
void lbfgs_parameter_init(lbfgs_parameter_t *param) void lbfgs_parameter_init(lbfgs_parameter_t *param)
{ {
memcpy(param, &_defparam, sizeof(*param)); memmove(param, &_defparam, sizeof(*param));
} }
int lbfgs( int lbfgs(

View File

@ -48,6 +48,7 @@
'$new_system_predicate'(Name,Arity,M), '$new_system_predicate'(Name,Arity,M),
sub_atom(Name,0,1,_, '$'), sub_atom(Name,0,1,_, '$'),
functor(P,Name,Arity), functor(P,Name,Arity),
writeln(M:P),
'$hide_predicate'(P,M), '$hide_predicate'(P,M),
fail. fail.
'$protect' :- '$protect' :-

View File

@ -2225,7 +2225,7 @@ rlc_save_font_options(HFONT font, rlc_console_attr *attr)
{ LOGFONT lf; { LOGFONT lf;
if ( GetObject(font, sizeof(lf), &lf) ) if ( GetObject(font, sizeof(lf), &lf) )
{ memcpy(attr->face_name, lf.lfFaceName, sizeof(attr->face_name)-1); { memmove(attr->face_name, lf.lfFaceName, sizeof(attr->face_name)-1);
attr->font_family = lf.lfPitchAndFamily; attr->font_family = lf.lfPitchAndFamily;
attr->font_size = lf.lfHeight; attr->font_size = lf.lfHeight;
@ -3803,7 +3803,7 @@ Dprint_lines(RlcData b, int from, int to)
for( ; ; from = NextLine(b, from)) for( ; ; from = NextLine(b, from))
{ TextLine tl = &b->lines[from]; { TextLine tl = &b->lines[from];
memcpy(buf, tl->text, tl->size); memmove(buf, tl->text, tl->size);
buf[tl->size] = EOS; buf[tl->size] = EOS;
Dprintf(_T("%03d: (0x%08x) \"%s\"\n"), from, tl->text, buf); Dprintf(_T("%03d: (0x%08x) \"%s\"\n"), from, tl->text, buf);