aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-18 13:19:03 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-18 13:33:47 +0100
commit7c29dc8db20a3e6f1fb351c44a068171bb6c1ff1 (patch)
treece41a8f9388d910ff1f397e21f2005902eb682ca
parent057c208b6fccfabe56b035a19666ddf0c777aeec (diff)
Cleanup: Move xxhash32 code to libutil
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--COPYING.md6
-rw-r--r--include/util.h2
-rw-r--r--lib/sqfs/Makemodule.am2
-rw-r--r--lib/sqfs/block_processor/internal.h2
-rw-r--r--lib/util/Makemodule.am1
-rw-r--r--lib/util/xxhash.c (renamed from lib/sqfs/block_processor/xxhash.c)4
6 files changed, 9 insertions, 8 deletions
diff --git a/COPYING.md b/COPYING.md
index b29ab60..d929391 100644
--- a/COPYING.md
+++ b/COPYING.md
@@ -5,9 +5,9 @@ The `libsquashfs` library is released under the terms and conditions of the
all source code in the directories `lib/sqfs`, `lib/util` and `include/sqfs`
with the following exceptions:
- - `lib/sqfs/block_processor/xxhash.c` contains a modified implementation of
- the xxhash32 algorithm. See `licenses/xxhash.txt` for copyright and
- licensing information (2 clause BSD license).
+ - `lib/util/xxhash.c` contains a modified implementation of the xxhash32
+ algorithm. See `licenses/xxhash.txt` for copyright and licensing
+ information (2 clause BSD license).
- `lib/sqfs/comp/lz4` contains files extracted from the LZ4 compression
library. See `lib/sqfs/comp/lz4/README` for details and `licenses/LZ4.txt`
for copyright and licensing information (2 clause BSD license).
diff --git a/include/util.h b/include/util.h
index a379c0d..6774be2 100644
--- a/include/util.h
+++ b/include/util.h
@@ -28,4 +28,6 @@ void *alloc_flex(size_t base_size, size_t item_size, size_t nmemb);
SQFS_INTERNAL
void *alloc_array(size_t item_size, size_t nmemb);
+SQFS_INTERNAL sqfs_u32 xxh32(const void *input, const size_t len);
+
#endif /* SQFS_UTIL_H */
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index 591eda2..942c37c 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -23,7 +23,6 @@ libsquashfs_la_SOURCES += lib/sqfs/inode.c
libsquashfs_la_SOURCES += lib/sqfs/write_super.c lib/sqfs/data_reader.c
libsquashfs_la_SOURCES += lib/sqfs/block_processor/internal.h
libsquashfs_la_SOURCES += lib/sqfs/block_processor/common.c
-libsquashfs_la_SOURCES += lib/sqfs/block_processor/xxhash.c
libsquashfs_la_SOURCES += lib/sqfs/frag_table.c include/sqfs/frag_table.h
libsquashfs_la_SOURCES += lib/sqfs/block_writer.c include/sqfs/block_writer.h
libsquashfs_la_CPPFLAGS = $(AM_CPPFLAGS)
@@ -36,6 +35,7 @@ libsquashfs_la_LIBADD += $(ZSTD_LIBS) $(PTHREAD_LIBS)
# directly "import" stuff from libutil
libsquashfs_la_SOURCES += lib/util/str_table.c lib/util/alloc.c
+libsquashfs_la_SOURCES += lib/util/xxhash.c
if WINDOWS
libsquashfs_la_SOURCES += lib/sqfs/win32/io_file.c
diff --git a/lib/sqfs/block_processor/internal.h b/lib/sqfs/block_processor/internal.h
index 0e95551..fed0842 100644
--- a/lib/sqfs/block_processor/internal.h
+++ b/lib/sqfs/block_processor/internal.h
@@ -71,6 +71,4 @@ int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
SQFS_INTERNAL
int append_to_work_queue(sqfs_block_processor_t *proc, sqfs_block_t *block);
-SQFS_INTERNAL sqfs_u32 xxh32(const void *input, const size_t len);
-
#endif /* INTERNAL_H */
diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am
index 87f3495..5cff2dd 100644
--- a/lib/util/Makemodule.am
+++ b/lib/util/Makemodule.am
@@ -1,6 +1,7 @@
libutil_a_SOURCES = include/util.h include/str_table.h
libutil_a_SOURCES += lib/util/str_table.c lib/util/alloc.c
libutil_a_SOURCES += lib/util/rbtree.c include/rbtree.h
+libutil_a_SOURCES += lib/util/xxhash.c
libutil_a_CFLAGS = $(AM_CFLAGS)
libutil_a_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/lib/sqfs/block_processor/xxhash.c b/lib/util/xxhash.c
index 8be4f9c..4e1e0e0 100644
--- a/lib/sqfs/block_processor/xxhash.c
+++ b/lib/util/xxhash.c
@@ -34,8 +34,8 @@
* - xxHash homepage: http://cyan4973.github.io/xxHash/
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
-#define SQFS_BUILDING_DLL
-#include "internal.h"
+#include "config.h"
+#include "util.h"
#define xxh_rotl32(x, r) ((x << r) | (x >> (32 - r)))