summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2018-11-26 20:14:27 (GMT)
committerGitHub <noreply@github.com>2018-11-26 20:14:27 (GMT)
commit6689dae33ba1eb588abe3d3cb763bc5dc08878b3 (patch)
treeda9ac1e6989b345830b9f95d1fef67a1a04a8790
parent0983fd61eebd5123675c5afbbe5c073080c4ca96 (diff)
parentb192c86ba43b3b762e705f4cdd509da3250e1c0c (diff)
downloadlz4-6689dae33ba1eb588abe3d3cb763bc5dc08878b3.zip
lz4-6689dae33ba1eb588abe3d3cb763bc5dc08878b3.tar.gz
lz4-6689dae33ba1eb588abe3d3cb763bc5dc08878b3.tar.bz2
Merge pull request #610 from antinucleon/bootcamp
[amalgamation] lz4frame.c
-rw-r--r--doc/lz4_Frame_format.md2
-rw-r--r--lib/README.md13
-rw-r--r--lib/lz4frame.c7
-rw-r--r--tests/Makefile1
4 files changed, 22 insertions, 1 deletions
diff --git a/doc/lz4_Frame_format.md b/doc/lz4_Frame_format.md
index 0c98df1..a8541f5 100644
--- a/doc/lz4_Frame_format.md
+++ b/doc/lz4_Frame_format.md
@@ -213,7 +213,7 @@ __Content Size__
This is the original (uncompressed) size.
This information is optional, and only present if the associated flag is set.
-Content size is provided using unsigned 8 Bytes, for a maximum of 16 HexaBytes.
+Content size is provided using unsigned 8 Bytes, for a maximum of 16 Exabytes.
Format is Little endian.
This value is informational, typically for display or memory allocation.
It can be skipped by a decoder, or used to validate content correctness.
diff --git a/lib/README.md b/lib/README.md
index 018ce40..a705de6 100644
--- a/lib/README.md
+++ b/lib/README.md
@@ -42,6 +42,19 @@ Should they be nonetheless needed, it's possible to force their publication
by using build macro `LZ4_PUBLISH_STATIC_FUNCTIONS`.
+#### Amalgamation
+
+lz4 code is able to be amalgamated into a single file.
+We can combine all source code in `lz4_all.c` by using following command,
+```
+cat lz4.c > lz4_all.c
+cat lz4hc.c >> lz4_all.c
+cat lz4frame.c >> lz4_all.c
+```
+and compile `lz4_all.c`.
+It's necessary to include all `*.h` files present in `/lib` together with `lz4_all.c`.
+
+
#### Windows : using MinGW+MSYS to create DLL
DLL can be created using MinGW+MSYS with the `make liblz4` command.
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 357f962..705832d 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -64,10 +64,15 @@ You can contact the author at :
**************************************/
#include <stdlib.h> /* malloc, calloc, free */
#define ALLOC(s) malloc(s)
+#ifndef LZ4_SRC_INCLUDED
#define ALLOC_AND_ZERO(s) calloc(1,(s))
+#endif
#define FREEMEM(p) free(p)
#include <string.h> /* memset, memcpy, memmove */
+#ifndef LZ4_SRC_INCLUDED
#define MEM_INIT memset
+#endif
+
/*-************************************
@@ -180,9 +185,11 @@ static void LZ4F_writeLE64 (void* dst, U64 value64)
/*-************************************
* Constants
**************************************/
+#ifndef LZ4_SRC_INCLUDED
#define KB *(1<<10)
#define MB *(1<<20)
#define GB *(1<<30)
+#endif
#define _1BIT 0x01
#define _2BITS 0x03
diff --git a/tests/Makefile b/tests/Makefile
index 24dc581..8dcef6d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -160,6 +160,7 @@ test32: test
test-amalgamation: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c
cat $(LZ4DIR)/lz4.c > lz4_all.c
cat $(LZ4DIR)/lz4hc.c >> lz4_all.c
+ cat $(LZ4DIR)/lz4frame.c >> lz4_all.c
$(CC) -I$(LZ4DIR) -c lz4_all.c
$(RM) lz4_all.c