Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memmove fix #2151

Merged
merged 2 commits into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Call SyMemmove instead of memmove
  • Loading branch information
ChrisJefferson committed Feb 5, 2018
commit 3e6f4f788c88849080c907ba988af61425366c27
7 changes: 4 additions & 3 deletions src/gasman.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@

#include <src/gaputils.h>
#include <src/io.h>
#include <src/sysfiles.h>


/****************************************************************************
Expand Down Expand Up @@ -1375,7 +1376,7 @@ UInt ResizeBag (
SET_PTR_BAG(bag, dst);

/* copy the contents of the bag */
memmove((void *)dst, (void *)DATA(header),
SyMemmove((void *)dst, (void *)DATA(header),
sizeof(Obj) * WORDS_BAG(old_size));
}

Expand Down Expand Up @@ -1902,7 +1903,7 @@ UInt CollectBags (

/* Otherwise do the default thing */
else if ( dst != DATA(header) ) {
memmove(dst, DATA(header), (end - DATA(header))*sizeof(Bag));
SyMemmove(dst, DATA(header), (end - DATA(header))*sizeof(Bag));
dst += end - DATA(header);
}
else {
Expand Down Expand Up @@ -2041,7 +2042,7 @@ UInt CollectBags (
i = SpaceBetweenPointers(EndBags,stopBags)/7 - (SizeMptrsArea-NrLiveBags);

/* move the bags area */
memmove(OldBags+i, OldBags, SizeAllBagsArea*sizeof(*OldBags));
SyMemmove(OldBags+i, OldBags, SizeAllBagsArea*sizeof(*OldBags));

/* update the masterpointers */
for ( p = MptrBags; p < OldBags; p++ ) {
Expand Down
5 changes: 3 additions & 2 deletions src/listfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <src/pperm.h>
#include <src/set.h>
#include <src/stringobj.h>
#include <src/sysfiles.h>
#include <src/trans.h>

#ifdef HPCGAP
Expand Down Expand Up @@ -100,7 +101,7 @@ void AddPlist3 (
if (pos <= len) {
GROW_PLIST(list, len+1);
SET_LEN_PLIST(list, len+1);
memmove(ADDR_OBJ(list) + pos+1,
SyMemmove(ADDR_OBJ(list) + pos+1,
CONST_ADDR_OBJ(list) + pos,
(size_t)(sizeof(Obj)*(len - pos + 1)));
}
Expand Down Expand Up @@ -1617,7 +1618,7 @@ Obj FuncCOPY_LIST_ENTRIES( Obj self, Obj args )
GROW_PLIST(srclist, srcmax);
if (srcinc == 1 && dstinc == 1)
{
memmove(ADDR_OBJ(dstlist) + dststart,
SyMemmove(ADDR_OBJ(dstlist) + dststart,
CONST_ADDR_OBJ(srclist) + srcstart,
(size_t) number*sizeof(Obj));
}
Expand Down
5 changes: 3 additions & 2 deletions src/opers.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <src/records.h>
#include <src/saveload.h>
#include <src/stringobj.h>
#include <src/sysfiles.h>

#ifdef HPCGAP
#include <src/hpc/aobjects.h>
Expand Down Expand Up @@ -2007,7 +2008,7 @@ static ALWAYS_INLINE Obj GetMethodCached(Obj oper,
Obj buf[cacheEntrySize];
memcpy(buf, cache + i,
sizeof(Obj) * cacheEntrySize);
memmove(cache + target + cacheEntrySize,
SyMemmove(cache + target + cacheEntrySize,
cache + target,
sizeof(Obj) * (i - target));
memcpy(cache + target, buf,
Expand All @@ -2033,7 +2034,7 @@ CacheMethod(Obj oper, UInt n, Int prec, Obj * ids, Obj method)
UInt cacheEntrySize = n + 2;
Bag cacheBag = GET_METHOD_CACHE(oper, n);
Obj * cache = 1 + prec * cacheEntrySize + ADDR_OBJ(cacheBag);
memmove(cache + cacheEntrySize, cache,
SyMemmove(cache + cacheEntrySize, cache,
sizeof(Obj) * (CACHE_SIZE - prec - 1) * cacheEntrySize);
cache[0] = method;
cache[1] = INTOBJ_INT(prec);
Expand Down
1 change: 1 addition & 0 deletions src/permutat.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <src/range.h>
#include <src/records.h>
#include <src/saveload.h>
#include <src/sysfiles.h>
#include <src/trans.h>

/****************************************************************************
Expand Down
3 changes: 2 additions & 1 deletion src/set.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <src/listfunc.h>
#include <src/lists.h>
#include <src/plist.h>
#include <src/sysfiles.h>


/****************************************************************************
Expand Down Expand Up @@ -449,7 +450,7 @@ Obj FuncADD_SET (
{
Obj *ptr;
ptr = PTR_BAG(set);
memmove(ptr + pos+1, ptr+pos, sizeof(Obj)*(len+1-pos));
SyMemmove(ptr + pos+1, ptr+pos, sizeof(Obj)*(len+1-pos));
}
SET_ELM_PLIST( set, pos, obj );
CHANGED_BAG( set );
Expand Down
2 changes: 1 addition & 1 deletion src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@ void InitSystem (
const UInt pathlen = strlen(SyGapRootPaths[i]);
if (SyGapRootPaths[i][0] == '~' &&
userhomelen + pathlen < sizeof(SyGapRootPaths[i])) {
memmove(SyGapRootPaths[i] + userhomelen,
SyMemmove(SyGapRootPaths[i] + userhomelen,
/* don't copy the ~ but the trailing '\0' */
SyGapRootPaths[i] + 1, pathlen);
memcpy(SyGapRootPaths[i], userhome, userhomelen);
Expand Down