Move #includes out of extern "C" blocks

Do some include shuffling for `**.h` files within lib, programs, tests, and zlibWrapper.
`lib/legacy` and `lib/deprecated` are untouched.
`#include`s within `extern "C"` blocks in .cpp files are untouched.

todo: shuffling for `xxhash.h`
This commit is contained in:
Victor Zhang
2024-12-17 17:55:07 -08:00
parent 0218c8de0f
commit fc726da774
27 changed files with 135 additions and 121 deletions
+4 -4
View File
@@ -14,9 +14,6 @@
#ifndef BITSTREAM_H_MODULE
#define BITSTREAM_H_MODULE
#if defined (__cplusplus)
extern "C" {
#endif
/*
* This API consists of small unitary functions, which must be inlined for best performance.
* Since link-time-optimization is not available for all compilers,
@@ -32,7 +29,6 @@ extern "C" {
#include "error_private.h" /* error codes and messages */
#include "bits.h" /* ZSTD_highbit32 */
/*=========================================
* Target specific
=========================================*/
@@ -44,6 +40,10 @@ extern "C" {
# endif
#endif
#if defined (__cplusplus)
extern "C" {
#endif
#define STREAM_ACCUMULATOR_MIN_32 25
#define STREAM_ACCUMULATOR_MIN_64 57
#define STREAM_ACCUMULATOR_MIN ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
+4 -5
View File
@@ -32,10 +32,6 @@
#ifndef DEBUG_H_12987983217
#define DEBUG_H_12987983217
#if defined (__cplusplus)
extern "C" {
#endif
/* static assert is triggered at compile time, leaving no runtime artefact.
* static assert only works with compile-time constants.
@@ -75,9 +71,12 @@ extern "C" {
# endif
#endif
#if defined (__cplusplus)
extern "C" {
#endif
#if (DEBUGLEVEL>=2)
# define ZSTD_DEPS_NEED_IO
# include "zstd_deps.h"
extern int g_debuglevel; /* the variable is only declared,
it actually lives in debug.c,
and is shared by the whole process.
+3 -5
View File
@@ -13,11 +13,6 @@
#ifndef ERROR_H_MODULE
#define ERROR_H_MODULE
#if defined (__cplusplus)
extern "C" {
#endif
/* ****************************************
* Dependencies
******************************************/
@@ -26,6 +21,9 @@ extern "C" {
#include "debug.h"
#include "zstd_deps.h" /* size_t */
#if defined (__cplusplus)
extern "C" {
#endif
/* ****************************************
* Compiler-specific
+8 -8
View File
@@ -11,11 +11,6 @@
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
****************************************************************** */
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef FSE_H
#define FSE_H
@@ -25,6 +20,14 @@ extern "C" {
******************************************/
#include "zstd_deps.h" /* size_t, ptrdiff_t */
#if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY)
#define FSE_H_FSE_STATIC_LINKING_ONLY
#include "bitstream.h"
#endif
#if defined (__cplusplus)
extern "C" {
#endif
/*-*****************************************
* FSE_PUBLIC_API : control library symbols visibility
@@ -233,9 +236,6 @@ If there is an error, the function will return an error code, which can be teste
#if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY)
#define FSE_H_FSE_STATIC_LINKING_ONLY
/* *** Dependency *** */
#include "bitstream.h"
/* *****************************************
* Static allocation
+3 -4
View File
@@ -12,10 +12,6 @@
* You may select, at your option, one of the above-listed licenses.
****************************************************************** */
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef HUF_H_298734234
#define HUF_H_298734234
@@ -25,6 +21,9 @@ extern "C" {
#define FSE_STATIC_LINKING_ONLY
#include "fse.h"
#if defined (__cplusplus)
extern "C" {
#endif
/* *** Tool functions *** */
#define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
+4 -4
View File
@@ -11,10 +11,6 @@
#ifndef MEM_H_MODULE
#define MEM_H_MODULE
#if defined (__cplusplus)
extern "C" {
#endif
/*-****************************************
* Dependencies
******************************************/
@@ -77,6 +73,10 @@ extern "C" {
#endif
#if defined (__cplusplus)
extern "C" {
#endif
/*-**************************************************************
* Memory I/O API
*****************************************************************/
+4 -4
View File
@@ -11,15 +11,15 @@
#ifndef POOL_H
#define POOL_H
#if defined (__cplusplus)
extern "C" {
#endif
#include "zstd_deps.h"
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_customMem */
#include "../zstd.h"
#if defined (__cplusplus)
extern "C" {
#endif
typedef struct POOL_ctx_s POOL_ctx;
/*! POOL_create() :
+23 -4
View File
@@ -16,10 +16,6 @@
#include "debug.h"
#if defined (__cplusplus)
extern "C" {
#endif
#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
/**
@@ -60,6 +56,11 @@ extern "C" {
#define ZSTD_pthread_cond_signal(a) WakeConditionVariable((a))
#define ZSTD_pthread_cond_broadcast(a) WakeAllConditionVariable((a))
#if defined (__cplusplus)
extern "C" {
#endif
/* ZSTD_pthread_create() and ZSTD_pthread_join() */
typedef HANDLE ZSTD_pthread_t;
@@ -73,10 +74,19 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread);
*/
#if defined (__cplusplus)
}
#endif
#elif defined(ZSTD_MULTITHREAD) /* posix assumed ; need a better detection method */
/* === POSIX Systems === */
# include <pthread.h>
#if defined (__cplusplus)
extern "C" {
#endif
#if DEBUGLEVEL < 1
#define ZSTD_pthread_mutex_t pthread_mutex_t
@@ -123,9 +133,18 @@ int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond);
#endif
#if defined (__cplusplus)
}
#endif
#else /* ZSTD_MULTITHREAD not defined */
/* No multithreading support */
#if defined (__cplusplus)
extern "C" {
#endif
typedef int ZSTD_pthread_mutex_t;
#define ZSTD_pthread_mutex_init(a, b) ((void)(a), (void)(b), 0)
#define ZSTD_pthread_mutex_destroy(a) ((void)(a))
+2 -2
View File
@@ -11,12 +11,12 @@
#ifndef ZSTD_TRACE_H
#define ZSTD_TRACE_H
#include <stddef.h>
#if defined (__cplusplus)
extern "C" {
#endif
#include <stddef.h>
/* weak symbol support
* For now, enable conservatively:
* - Only GNUC