summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2018-12-02 18:42:38 (GMT)
committerVincent Torri <vincent.torri@gmail.com>2018-12-02 18:42:38 (GMT)
commit9021648ba7325f7d27263119036c60d88cdfda4a (patch)
treeb1b37259f1cc06b775d6801df1aa737589de6999 /lib
parentb03714dc80772daeff5a71762fc4018156a258ff (diff)
parent4d60ecc9c77e7db447a06321e28533ffbd4ce6a9 (diff)
downloadlz4-9021648ba7325f7d27263119036c60d88cdfda4a.zip
lz4-9021648ba7325f7d27263119036c60d88cdfda4a.tar.gz
lz4-9021648ba7325f7d27263119036c60d88cdfda4a.tar.bz2
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'lib')
-rw-r--r--lib/README.md13
-rw-r--r--lib/lz4frame.c7
2 files changed, 20 insertions, 0 deletions
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