]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Cleanup from Move
authorW. Felix Handte <w@felixhandte.com>
Tue, 20 Aug 2019 18:15:06 +0000 (14:15 -0400)
committerW. Felix Handte <w@felixhandte.com>
Mon, 9 Sep 2019 17:34:08 +0000 (13:34 -0400)
lib/compress/zstd_cwksp.c
lib/compress/zstd_cwksp.h

index 3b7341eb94532e93eb0e536c315148b855ccbf71..a117ad09dc4d8b9feff3217ab5a8349668bf151c 100644 (file)
 
 #include "zstd_cwksp.h"
 
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
 /**
  * Align must be a power of 2.
  */
@@ -22,7 +26,7 @@ size_t ZSTD_cwksp_align(size_t size, size_t const align) {
 /**
  * Internal function, use wrappers instead.
  */
-void* ZSTD_cwksp_reserve_internal(ZSTD_cwksp* ws, size_t bytes, ZSTD_cwksp_alloc_phase_e phase) {
+static void* ZSTD_cwksp_reserve_internal(ZSTD_cwksp* ws, size_t bytes, ZSTD_cwksp_alloc_phase_e phase) {
     /* TODO(felixh): alignment */
     void* alloc = (BYTE *)ws->allocStart - bytes;
     void* bottom = ws->tableEnd;
@@ -200,4 +204,8 @@ size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws) {
 
 int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp* ws) {
     return ws->allocFailed;
-}
\ No newline at end of file
+}
+
+#if defined (__cplusplus)
+}
+#endif
index b5b358493e6eff7e4c7c8d7f3219207b443ba464..965ca6b0e4c9315c6727ed599cd18a5387f8366c 100644 (file)
 #ifndef ZSTD_CWKSP_H
 #define ZSTD_CWKSP_H
 
+/*-*************************************
+*  Dependencies
+***************************************/
 #include "zstd_internal.h"
 
-#define ZSTD_WORKSPACETOOLARGE_FACTOR 3 /* define "workspace is too large" as this number of times larger than needed */
-#define ZSTD_WORKSPACETOOLARGE_MAXDURATION 128  /* when workspace is continuously too large
-                                         * during at least this number of times,
-                                         * context's memory usage is considered wasteful,
-                                         * because it's sized to handle a worst case scenario which rarely happens.
-                                         * In which case, resize it down to free some memory */
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/*-*************************************
+*  Constants
+***************************************/
+
+/* define "workspace is too large" as this number of times larger than needed */
+#define ZSTD_WORKSPACETOOLARGE_FACTOR 3
+
+/* when workspace is continuously too large
+ * during at least this number of times,
+ * context's memory usage is considered wasteful,
+ * because it's sized to handle a worst case scenario which rarely happens.
+ * In which case, resize it down to free some memory */
+#define ZSTD_WORKSPACETOOLARGE_MAXDURATION 128
+
+/*-*************************************
+*  Structures
+***************************************/
 typedef enum {
     ZSTD_cwksp_alloc_objects,
     ZSTD_cwksp_alloc_buffers,
@@ -110,16 +128,15 @@ typedef struct {
     ZSTD_cwksp_alloc_phase_e phase;
 } ZSTD_cwksp;
 
+/*-*************************************
+*  Functions
+***************************************/
+
 /**
  * Align must be a power of 2.
  */
 size_t ZSTD_cwksp_align(size_t size, size_t const align);
 
-/**
- * Internal function, use wrappers instead.
- */
-void* ZSTD_cwksp_reserve_internal(ZSTD_cwksp* ws, size_t bytes, ZSTD_cwksp_alloc_phase_e phase);
-
 /**
  * Unaligned.
  */
@@ -172,4 +189,8 @@ size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws);
 
 int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp* ws);
 
+#if defined (__cplusplus)
+}
+#endif
+
 #endif /* ZSTD_CWKSP_H */