diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-07-08 08:42:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-07-08 08:54:34 +0300 |
commit | 83fe139b2b9c37db50c14833cb38877b999db6de (patch) | |
tree | 079729ccd664f230a98440bc5175acc4155a27b0 /source/blender/blenloader/intern | |
parent | dda96e34725a3e12b83696db311dde10e1126cd6 (diff) |
Undo: use system memcmp
`my_memcmp` didn't work properly comparing memory sizes not aligned to 4 bytes,
this worked while we used guarded-alloc (which always wrote a guard at the end of each allocation).
Since moving to lockfree allocator it could read uninitialized memory.
It also consistently performed ~10-30% worse then glibc's.
This is typically well optimized, no need to do ourselves.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/undofile.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c index d0dc9a88cc0..c191e48a143 100644 --- a/source/blender/blenloader/intern/undofile.c +++ b/source/blender/blenloader/intern/undofile.c @@ -80,20 +80,6 @@ void BLO_memfile_merge(MemFile *first, MemFile *second) BLO_memfile_free(first); } -static int my_memcmp(const int *mem1, const int *mem2, const int len) -{ - register int a = len; - register const int *mema = mem1; - register const int *memb = mem2; - - while (a--) { - if (*mema != *memb) return 1; - mema++; - memb++; - } - return 0; -} - void memfile_chunk_add(MemFile *compare, MemFile *current, const char *buf, unsigned int size) { static MemFileChunk *compchunk = NULL; @@ -118,7 +104,7 @@ void memfile_chunk_add(MemFile *compare, MemFile *current, const char *buf, unsi /* we compare compchunk with buf */ if (compchunk) { if (compchunk->size == curchunk->size) { - if (my_memcmp((int *)compchunk->buf, (const int *)buf, size / 4) == 0) { + if (memcmp(compchunk->buf, buf, size) == 0) { curchunk->buf = compchunk->buf; curchunk->ident = 1; } |