mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 20:28:30 +00:00
Make more functions friendly to Address Sanitizer
This commit is contained in:
parent
3ab76b2312
commit
cbfd4ccd1e
70 changed files with 1267 additions and 291 deletions
12
third_party/lz4cli/bench.c
vendored
12
third_party/lz4cli/bench.c
vendored
|
@ -36,8 +36,8 @@
|
|||
/* *************************************
|
||||
* Includes
|
||||
***************************************/
|
||||
#include "platform.h" /* Compiler options */
|
||||
#include "util.h" /* UTIL_GetFileSize, UTIL_sleep */
|
||||
#include "third_party/lz4cli/platform.h" /* Compiler options */
|
||||
#include "third_party/lz4cli/util.h" /* UTIL_GetFileSize, UTIL_sleep */
|
||||
#include "libc/mem/mem.h" /* malloc, free */
|
||||
#include "libc/str/str.h" /* memset */
|
||||
#include "libc/stdio/stdio.h" /* fprintf, fopen, ftello */
|
||||
|
@ -46,17 +46,17 @@
|
|||
#include "libc/bits/initializer.internal.h"
|
||||
#include "libc/runtime/runtime.h" /* assert */
|
||||
|
||||
#include "datagen.h" /* RDG_genBuffer */
|
||||
#include "xxhash.h"
|
||||
#include "third_party/lz4cli/datagen.h" /* RDG_genBuffer */
|
||||
#include "third_party/lz4cli/xxhash.h"
|
||||
|
||||
|
||||
#include "lz4.h"
|
||||
#include "third_party/lz4cli/lz4.h"
|
||||
#define COMPRESSOR0 LZ4_compress_local
|
||||
static int LZ4_compress_local(const char* src, char* dst, int srcSize, int dstSize, int clevel) {
|
||||
int const acceleration = (clevel < 0) ? -clevel + 1 : 1;
|
||||
return LZ4_compress_fast(src, dst, srcSize, dstSize, acceleration);
|
||||
}
|
||||
#include "lz4hc.h"
|
||||
#include "third_party/lz4cli/lz4hc.h"
|
||||
#define COMPRESSOR1 LZ4_compress_HC
|
||||
#define DEFAULTCOMPRESSOR COMPRESSOR0
|
||||
#define LZ4_isError(errcode) (errcode==0)
|
||||
|
|
4
third_party/lz4cli/datagen.c
vendored
4
third_party/lz4cli/datagen.c
vendored
|
@ -27,8 +27,8 @@
|
|||
/**************************************
|
||||
* Includes
|
||||
**************************************/
|
||||
#include "platform.h" /* Compiler options, SET_BINARY_MODE */
|
||||
#include "util.h" /* U32 */
|
||||
#include "third_party/lz4cli/platform.h" /* Compiler options, SET_BINARY_MODE */
|
||||
#include "third_party/lz4cli/util.h" /* U32 */
|
||||
#include "libc/mem/mem.h" /* malloc */
|
||||
#include "libc/stdio/stdio.h" /* FILE, fwrite */
|
||||
#include "libc/str/str.h" /* memcpy */
|
||||
|
|
2
third_party/lz4cli/lz4.c
vendored
2
third_party/lz4cli/lz4.c
vendored
|
@ -94,7 +94,7 @@
|
|||
**************************************/
|
||||
#define LZ4_STATIC_LINKING_ONLY
|
||||
#define LZ4_DISABLE_DEPRECATE_WARNINGS /* due to LZ4_decompress_safe_withPrefix64k */
|
||||
#include "lz4.h"
|
||||
#include "third_party/lz4cli/lz4.h"
|
||||
/* see also "memory routines" below */
|
||||
|
||||
|
||||
|
|
12
third_party/lz4cli/lz4cli.c
vendored
12
third_party/lz4cli/lz4cli.c
vendored
|
@ -36,17 +36,17 @@ asm(".include \"third_party/lz4cli/COPYING\"");
|
|||
/****************************
|
||||
* Includes
|
||||
*****************************/
|
||||
#include "platform.h" /* Compiler options, IS_CONSOLE */
|
||||
#include "util.h" /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList */
|
||||
#include "third_party/lz4cli/platform.h" /* Compiler options, IS_CONSOLE */
|
||||
#include "third_party/lz4cli/util.h" /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList */
|
||||
#include "libc/stdio/stdio.h" /* fprintf, getchar */
|
||||
#include "libc/mem/mem.h" /* exit, calloc, free */
|
||||
#include "libc/str/str.h" /* strcmp, strlen */
|
||||
#include "bench.h" /* BMK_benchFile, BMK_SetNbIterations, BMK_SetBlocksize, BMK_SetPause */
|
||||
#include "lz4io.h" /* LZ4IO_compressFilename, LZ4IO_decompressFilename, LZ4IO_compressMultipleFilenames */
|
||||
#include "lz4hc.h" /* LZ4HC_CLEVEL_MAX */
|
||||
#include "third_party/lz4cli/bench.h" /* BMK_benchFile, BMK_SetNbIterations, BMK_SetBlocksize, BMK_SetPause */
|
||||
#include "third_party/lz4cli/lz4io.h" /* LZ4IO_compressFilename, LZ4IO_decompressFilename, LZ4IO_compressMultipleFilenames */
|
||||
#include "third_party/lz4cli/lz4hc.h" /* LZ4HC_CLEVEL_MAX */
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "lz4.h" /* LZ4_VERSION_STRING */
|
||||
#include "third_party/lz4cli/lz4.h" /* LZ4_VERSION_STRING */
|
||||
|
||||
|
||||
/*****************************
|
||||
|
|
4
third_party/lz4cli/lz4cli.mk
vendored
4
third_party/lz4cli/lz4cli.mk
vendored
|
@ -13,6 +13,10 @@
|
|||
|
||||
PKGS += THIRD_PARTY_LZ4CLI
|
||||
|
||||
THIRD_PARTY_LZ4CLI_FILES := $(wildcard third_party/lz4cli/*)
|
||||
THIRD_PARTY_LZ4CLI_SRCS = $(filter %.c,$(THIRD_PARTY_LZ4CLI_FILES))
|
||||
THIRD_PARTY_LZ4CLI_HDRS = $(filter %.h,$(THIRD_PARTY_LZ4CLI_FILES))
|
||||
|
||||
THIRD_PARTY_LZ4CLI = \
|
||||
o/$(MODE)/third_party/lz4cli/lz4cli.com
|
||||
|
||||
|
|
4
third_party/lz4cli/lz4hc.c
vendored
4
third_party/lz4cli/lz4hc.c
vendored
|
@ -51,7 +51,7 @@
|
|||
|
||||
/*=== Dependency ===*/
|
||||
#define LZ4_HC_STATIC_LINKING_ONLY
|
||||
#include "lz4hc.h"
|
||||
#include "third_party/lz4cli/lz4hc.h"
|
||||
|
||||
|
||||
/*=== Common LZ4 definitions ===*/
|
||||
|
@ -63,7 +63,7 @@
|
|||
#endif
|
||||
|
||||
#define LZ4_COMMONDEFS_ONLY
|
||||
#include "lz4.c" /* LZ4_count, constants, mem */
|
||||
#include "third_party/lz4cli/lz4.c" /* LZ4_count, constants, mem */
|
||||
|
||||
|
||||
/*=== Constants ===*/
|
||||
|
|
2
third_party/lz4cli/lz4hc.h
vendored
2
third_party/lz4cli/lz4hc.h
vendored
|
@ -41,7 +41,7 @@ extern "C" {
|
|||
|
||||
/* --- Dependency --- */
|
||||
/* note : lz4hc requires lz4.h/lz4.c for compilation */
|
||||
#include "lz4.h" /* stddef, LZ4LIB_API, LZ4_DEPRECATED */
|
||||
#include "third_party/lz4cli/lz4.h" /* stddef, LZ4LIB_API, LZ4_DEPRECATED */
|
||||
|
||||
|
||||
/* --- Useful constants --- */
|
||||
|
|
2
third_party/lz4cli/xxhash.c
vendored
2
third_party/lz4cli/xxhash.c
vendored
|
@ -106,7 +106,7 @@ static void XXH_free (void* p) { free(p); }
|
|||
static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
|
||||
|
||||
#define XXH_STATIC_LINKING_ONLY
|
||||
#include "xxhash.h"
|
||||
#include "third_party/lz4cli/xxhash.h"
|
||||
|
||||
|
||||
/* *************************************
|
||||
|
|
2
third_party/lz4cli/xxhash.h
vendored
2
third_party/lz4cli/xxhash.h
vendored
|
@ -280,7 +280,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src
|
|||
#endif
|
||||
|
||||
# ifdef XXH_PRIVATE_API
|
||||
# include "xxhash.c" /* include xxhash function bodies as `static`, for inlining */
|
||||
# include "third_party/lz4cli/xxhash.c" /* include xxhash function bodies as `static`, for inlining */
|
||||
# endif
|
||||
|
||||
#endif /* XXH_STATIC_LINKING_ONLY */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue