summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorTakayuki Matsuoka <t-mat@users.noreply.github.com>2022-07-31 11:59:09 (GMT)
committerTakayuki Matsuoka <t-mat@users.noreply.github.com>2022-07-31 11:59:09 (GMT)
commit5d80375deddf33f2392eb2ea678cf2e203bb24fb (patch)
tree540503e61f4cc4f7840e1daaf880a7e4024fd749 /lib/lz4hc.c
parent2042692400bc0fe3a9376715db7c33e5f16d83f6 (diff)
downloadlz4-5d80375deddf33f2392eb2ea678cf2e203bb24fb.zip
lz4-5d80375deddf33f2392eb2ea678cf2e203bb24fb.tar.gz
lz4-5d80375deddf33f2392eb2ea678cf2e203bb24fb.tar.bz2
New macro for memcpy, memmove and memset
This changeset introduces the following external macros. - Add new macro LZ4_memset() which enables to inject external function as memset(). - Similar macro LZ4_memmove() for memmove(). - In same manner, LZ4_memcpy() also can be overriden by external macro.
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 6b139fa..e854cb4 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -755,7 +755,7 @@ _last_literals:
} else {
*op++ = (BYTE)(lastRunSize << ML_BITS);
}
- memcpy(op, anchor, lastRunSize);
+ LZ4_memcpy(op, anchor, lastRunSize);
op += lastRunSize;
}
@@ -894,7 +894,7 @@ LZ4HC_compress_generic_dictCtx (
ctx->dictCtx = NULL;
return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
} else if (position == 0 && *srcSizePtr > 4 KB) {
- memcpy(ctx, ctx->dictCtx, sizeof(LZ4HC_CCtx_internal));
+ LZ4_memcpy(ctx, ctx->dictCtx, sizeof(LZ4HC_CCtx_internal));
LZ4HC_setExternalDict(ctx, (const BYTE *)src);
ctx->compressionLevel = (short)cLevel;
return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
@@ -1177,7 +1177,7 @@ int LZ4_saveDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, char* safeBuffer, int dictS
if (dictSize > prefixSize) dictSize = prefixSize;
if (safeBuffer == NULL) assert(dictSize == 0);
if (dictSize > 0)
- memmove(safeBuffer, streamPtr->end - dictSize, dictSize);
+ LZ4_memmove(safeBuffer, streamPtr->end - dictSize, dictSize);
{ U32 const endIndex = (U32)(streamPtr->end - streamPtr->prefixStart) + streamPtr->dictLimit;
streamPtr->end = (const BYTE*)safeBuffer + dictSize;
streamPtr->prefixStart = streamPtr->end - dictSize;
@@ -1587,7 +1587,7 @@ _last_literals:
} else {
*op++ = (BYTE)(lastRunSize << ML_BITS);
}
- memcpy(op, anchor, lastRunSize);
+ LZ4_memcpy(op, anchor, lastRunSize);
op += lastRunSize;
}