Page MenuHomeFreeBSD

D10407.id30302.diff
No OneTemporary

D10407.id30302.diff

Index: contrib/zstd/lib/common/error_private.h
===================================================================
--- contrib/zstd/lib/common/error_private.h
+++ contrib/zstd/lib/common/error_private.h
@@ -20,7 +20,11 @@
/* ****************************************
* Dependencies
******************************************/
+#ifdef _KERNEL
+#include <sys/types.h> /* size_t */
+#else
#include <stddef.h> /* size_t */
+#endif
#include "zstd_errors.h" /* enum list */
Index: contrib/zstd/lib/common/fse.h
===================================================================
--- contrib/zstd/lib/common/fse.h
+++ contrib/zstd/lib/common/fse.h
@@ -42,7 +42,11 @@
/*-*****************************************
* Dependencies
******************************************/
+#ifdef _KERNEL
+#include <sys/param.h> /* size_t, ptrdiff_t */
+#else
#include <stddef.h> /* size_t, ptrdiff_t */
+#endif
/*-*****************************************
Index: contrib/zstd/lib/common/fse_decompress.c
===================================================================
--- contrib/zstd/lib/common/fse_decompress.c
+++ contrib/zstd/lib/common/fse_decompress.c
@@ -57,8 +57,13 @@
/* **************************************************************
* Includes
****************************************************************/
+#ifdef _KERNEL
+#include <sys/malloc.h> /* malloc, free */
+#include <sys/systm.h> /* memset */
+#else
#include <stdlib.h> /* malloc, free, qsort */
#include <string.h> /* memcpy, memset */
+#endif
#include "bitstream.h"
#define FSE_STATIC_LINKING_ONLY
#include "fse.h"
@@ -101,12 +106,20 @@
FSE_DTable* FSE_createDTable (unsigned tableLog)
{
if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX;
+#ifdef _KERNEL
+ return (FSE_DTable*)malloc( FSE_DTABLE_SIZE_U32(tableLog) * sizeof (U32), M_TEMP, M_WAITOK);
+#else
return (FSE_DTable*)malloc( FSE_DTABLE_SIZE_U32(tableLog) * sizeof (U32) );
+#endif
}
void FSE_freeDTable (FSE_DTable* dt)
{
+#ifdef _KERNEL
+ free(dt, M_TEMP);
+#else
free(dt);
+#endif
}
size_t FSE_buildDTable(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog)
Index: contrib/zstd/lib/common/huf.h
===================================================================
--- contrib/zstd/lib/common/huf.h
+++ contrib/zstd/lib/common/huf.h
@@ -40,7 +40,11 @@
/* *** Dependencies *** */
+#ifdef _KERNEL
+#include <sys/types.h> /* size_t */
+#else
#include <stddef.h> /* size_t */
+#endif
/* *** library symbols visibility *** */
Index: contrib/zstd/lib/common/mem.h
===================================================================
--- contrib/zstd/lib/common/mem.h
+++ contrib/zstd/lib/common/mem.h
@@ -17,8 +17,13 @@
/*-****************************************
* Dependencies
******************************************/
+#ifdef _KERNEL
+#include <sys/types.h> /* size_t */
+#include <sys/systm.h> /* memcpy */
+#else
#include <stddef.h> /* size_t, ptrdiff_t */
#include <string.h> /* memcpy */
+#endif
/*-****************************************
@@ -47,7 +52,9 @@
* Basic Types
*****************************************************************/
#if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
+#ifndef _KERNEL
# include <stdint.h>
+#endif
typedef uint8_t BYTE;
typedef uint16_t U16;
typedef int16_t S16;
Index: contrib/zstd/lib/common/pool.h
===================================================================
--- contrib/zstd/lib/common/pool.h
+++ contrib/zstd/lib/common/pool.h
@@ -14,7 +14,11 @@
#endif
+#ifdef _KERNEL
+#include <sys/types.h>
+#else
#include <stddef.h> /* size_t */
+#endif
typedef struct POOL_ctx_s POOL_ctx;
Index: contrib/zstd/lib/common/pool.c
===================================================================
--- contrib/zstd/lib/common/pool.c
+++ contrib/zstd/lib/common/pool.c
@@ -9,8 +9,13 @@
/* ====== Dependencies ======= */
+#ifdef _KERNEL
+#include <sys/types.h>
+#include <sys/systm.h>
+#else
#include <stddef.h> /* size_t */
#include <stdlib.h> /* malloc, calloc, free */
+#endif
#include "pool.h"
/* ====== Compiler specifics ====== */
Index: contrib/zstd/lib/common/xxhash.h
===================================================================
--- contrib/zstd/lib/common/xxhash.h
+++ contrib/zstd/lib/common/xxhash.h
@@ -75,7 +75,11 @@
/* ****************************
* Definitions
******************************/
+#ifdef _KERNEL
+#include <sys/types.h> /* size_t */
+#else
#include <stddef.h> /* size_t */
+#endif
typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
Index: contrib/zstd/lib/common/xxhash.c
===================================================================
--- contrib/zstd/lib/common/xxhash.c
+++ contrib/zstd/lib/common/xxhash.c
@@ -97,11 +97,20 @@
***************************************/
/* Modify the local functions below should you wish to use some other memory routines */
/* for malloc(), free() */
+#ifdef _KERNEL
+#include <sys/malloc.h>
+#include <sys/types.h>
+static void* XXH_malloc(size_t s) { return malloc(s, M_TEMP, M_WAITOK); }
+static void XXH_free (void* p) { free(p, M_TEMP); }
+/* for memcpy() */
+#include <sys/systm.h>
+#else
#include <stdlib.h>
static void* XXH_malloc(size_t s) { return malloc(s); }
static void XXH_free (void* p) { free(p); }
/* for memcpy() */
#include <string.h>
+#endif
static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
#ifndef XXH_STATIC_LINKING_ONLY
@@ -135,7 +144,9 @@
#ifndef MEM_MODULE
# define MEM_MODULE
# if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
+#ifndef _KERNEL
# include <stdint.h>
+#endif
typedef uint8_t BYTE;
typedef uint16_t U16;
typedef uint32_t U32;
Index: contrib/zstd/lib/common/zstd_common.c
===================================================================
--- contrib/zstd/lib/common/zstd_common.c
+++ contrib/zstd/lib/common/zstd_common.c
@@ -12,7 +12,9 @@
/*-*************************************
* Dependencies
***************************************/
+#ifndef _KERNEL
#include <stdlib.h> /* malloc */
+#endif
#include "error_private.h"
#define ZSTD_STATIC_LINKING_ONLY
#include "zstd.h" /* declaration of ZSTD_isError, ZSTD_getErrorName, ZSTD_getErrorCode, ZSTD_getErrorString, ZSTD_versionNumber */
@@ -50,15 +52,23 @@
/* default uses stdlib */
void* ZSTD_defaultAllocFunction(void* opaque, size_t size)
{
+#ifdef _KERNEL
+ void* address = zstd_alloc(opaque, size);
+#else
void* address = malloc(size);
(void)opaque;
+#endif
return address;
}
void ZSTD_defaultFreeFunction(void* opaque, void* address)
{
+#ifdef _KERNEL
+ zstd_free(opaque, address);
+#else
(void)opaque;
free(address);
+#endif
}
void* ZSTD_malloc(size_t size, ZSTD_customMem customMem)
Index: contrib/zstd/lib/common/zstd_errors.h
===================================================================
--- contrib/zstd/lib/common/zstd_errors.h
+++ contrib/zstd/lib/common/zstd_errors.h
@@ -15,7 +15,11 @@
#endif
/*===== dependency =====*/
+#ifdef _KERNEL
+#include <sys/types.h> /* size_t */
+#else
#include <stddef.h> /* size_t */
+#endif
/* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */
Index: contrib/zstd/lib/compress/fse_compress.c
===================================================================
--- contrib/zstd/lib/compress/fse_compress.c
+++ contrib/zstd/lib/compress/fse_compress.c
@@ -56,9 +56,14 @@
/* **************************************************************
* Includes
****************************************************************/
+#ifdef _KERNEL
+#include <sys/malloc.h> /* malloc, free */
+#include <sys/systm.h> /* memcpy, memset */
+#else
#include <stdlib.h> /* malloc, free, qsort */
#include <string.h> /* memcpy, memset */
#include <stdio.h> /* printf (debug) */
+#endif
#include "bitstream.h"
#define FSE_STATIC_LINKING_ONLY
#include "fse.h"
@@ -468,10 +473,20 @@
size_t size;
if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX;
size = FSE_CTABLE_SIZE_U32 (tableLog, maxSymbolValue) * sizeof(U32);
+#ifdef _KERNEL
+ return (FSE_CTable*)malloc(size, M_TEMP, M_WAITOK);
+#else
return (FSE_CTable*)malloc(size);
+#endif
}
-void FSE_freeCTable (FSE_CTable* ct) { free(ct); }
+void FSE_freeCTable (FSE_CTable* ct) {
+#ifdef _KERNEL
+ free(ct, M_TEMP);
+#else
+ free(ct);
+#endif
+}
/* provides the minimum logSize to safely represent a distribution */
static unsigned FSE_minTableLog(size_t srcSize, unsigned maxSymbolValue)
Index: contrib/zstd/lib/compress/huf_compress.c
===================================================================
--- contrib/zstd/lib/compress/huf_compress.c
+++ contrib/zstd/lib/compress/huf_compress.c
@@ -43,8 +43,12 @@
/* **************************************************************
* Includes
****************************************************************/
+#ifdef _KERNEL
+#include <sys/systm.h> /* memcpy, memset */
+#else
#include <string.h> /* memcpy, memset */
#include <stdio.h> /* printf (debug) */
+#endif
#include "bitstream.h"
#define FSE_STATIC_LINKING_ONLY /* FSE_optimalTableLog_internal */
#include "fse.h" /* header compression */
Index: contrib/zstd/lib/compress/zstd_compress.c
===================================================================
--- contrib/zstd/lib/compress/zstd_compress.c
+++ contrib/zstd/lib/compress/zstd_compress.c
@@ -11,7 +11,11 @@
/*-*************************************
* Dependencies
***************************************/
+#ifdef _KERNEL
+#include <sys/systm.h> /* memcpy, memset */
+#else
#include <string.h> /* memset */
+#endif
#include "mem.h"
#define FSE_STATIC_LINKING_ONLY /* FSE_encodeSymbol */
#include "fse.h"
Index: contrib/zstd/lib/decompress/huf_decompress.c
===================================================================
--- contrib/zstd/lib/decompress/huf_decompress.c
+++ contrib/zstd/lib/decompress/huf_decompress.c
@@ -54,7 +54,11 @@
/* **************************************************************
* Dependencies
****************************************************************/
+#ifdef _KERNEL
+#include <sys/systm.h> /* memcpy, memset */
+#else
#include <string.h> /* memcpy, memset */
+#endif
#include "bitstream.h" /* BIT_* */
#include "fse.h" /* header compression */
#define HUF_STATIC_LINKING_ONLY
Index: contrib/zstd/lib/decompress/zstd_decompress.c
===================================================================
--- contrib/zstd/lib/decompress/zstd_decompress.c
+++ contrib/zstd/lib/decompress/zstd_decompress.c
@@ -41,7 +41,11 @@
/*-*******************************************************
* Dependencies
*********************************************************/
+#ifdef _KERNEL
+#include <sys/systm.h> /* memcpy, memset */
+#else
#include <string.h> /* memcpy, memmove, memset */
+#endif
#include "mem.h" /* low level memory routines */
#define FSE_STATIC_LINKING_ONLY
#include "fse.h"
Index: contrib/zstd/lib/zstd.h
===================================================================
--- contrib/zstd/lib/zstd.h
+++ contrib/zstd/lib/zstd.h
@@ -15,7 +15,13 @@
#define ZSTD_H_235446
/* ====== Dependency ======*/
+#ifdef _KERNEL
+#include <sys/param.h> /* size_t */
+extern void *zstd_alloc(void *opaque, size_t size);
+extern void zstd_free(void *opaque, void *ptr);
+#else
#include <stddef.h> /* size_t */
+#endif
/* ===== ZSTDLIB_API : control library symbols visibility ===== */

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 24, 2:04 AM (2 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30220674
Default Alt Text
D10407.id30302.diff (11 KB)

Event Timeline