Skip to content

Commit 7e66bb4

Browse files
committed
do not export symbols unless explicitly enabled
1 parent 551a7cc commit 7e66bb4

File tree

14 files changed

+272
-272
lines changed

14 files changed

+272
-272
lines changed

lib/common/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#[export_name = crate::prefix!(g_debuglevel)]
1+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(g_debuglevel))]
22
pub static mut g_debuglevel: core::ffi::c_int = DEBUGLEVEL;
33
pub const DEBUGLEVEL: core::ffi::c_int = 0;

lib/common/pool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ unsafe fn POOL_thread(mut opaque: *mut core::ffi::c_void) -> *mut core::ffi::c_v
107107
pthread_mutex_unlock(&mut (*ctx).queueMutex);
108108
}
109109
}
110-
#[export_name = crate::prefix!(ZSTD_createThreadPool)]
110+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_createThreadPool))]
111111
pub unsafe extern "C" fn ZSTD_createThreadPool(mut numThreads: size_t) -> *mut ZSTD_threadPool {
112112
POOL_create(numThreads, 0)
113113
}
@@ -222,7 +222,7 @@ pub unsafe fn POOL_joinJobs(mut ctx: *mut POOL_ctx) {
222222
}
223223
pthread_mutex_unlock(&mut (*ctx).queueMutex);
224224
}
225-
#[export_name = crate::prefix!(ZSTD_freeThreadPool)]
225+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_freeThreadPool))]
226226
pub unsafe extern "C" fn ZSTD_freeThreadPool(mut pool: *mut ZSTD_threadPool) {
227227
POOL_free(pool);
228228
}

lib/common/zstd_common.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@ pub const ZSTD_VERSION_MINOR: core::ffi::c_int = 5;
1111
pub const ZSTD_VERSION_RELEASE: core::ffi::c_int = 8;
1212
pub const ZSTD_VERSION_NUMBER: core::ffi::c_int =
1313
ZSTD_VERSION_MAJOR * 100 * 100 + ZSTD_VERSION_MINOR * 100 + ZSTD_VERSION_RELEASE;
14-
#[export_name = crate::prefix!(ZSTD_versionNumber)]
14+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_versionNumber))]
1515
pub unsafe extern "C" fn ZSTD_versionNumber() -> core::ffi::c_uint {
1616
ZSTD_VERSION_NUMBER as core::ffi::c_uint
1717
}
18-
#[export_name = crate::prefix!(ZSTD_versionString)]
18+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_versionString))]
1919
pub unsafe extern "C" fn ZSTD_versionString() -> *const core::ffi::c_char {
2020
b"1.5.8\0" as *const u8 as *const core::ffi::c_char
2121
}
22-
#[export_name = crate::prefix!(ZSTD_isError)]
22+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_isError))]
2323
pub unsafe extern "C" fn ZSTD_isError(mut code: size_t) -> core::ffi::c_uint {
2424
ERR_isError(code)
2525
}
26-
#[export_name = crate::prefix!(ZSTD_getErrorName)]
26+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_getErrorName))]
2727
pub unsafe extern "C" fn ZSTD_getErrorName(mut code: size_t) -> *const core::ffi::c_char {
2828
ERR_getErrorName(code)
2929
}
30-
#[export_name = crate::prefix!(ZSTD_getErrorCode)]
30+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_getErrorCode))]
3131
pub unsafe extern "C" fn ZSTD_getErrorCode(mut code: size_t) -> ZSTD_ErrorCode {
3232
ERR_getErrorCode(code)
3333
}
34-
#[export_name = crate::prefix!(ZSTD_getErrorString)]
34+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_getErrorString))]
3535
pub unsafe extern "C" fn ZSTD_getErrorString(mut code: ZSTD_ErrorCode) -> *const core::ffi::c_char {
3636
ERR_getErrorString(code)
3737
}
38-
#[export_name = crate::prefix!(ZSTD_isDeterministicBuild)]
38+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_isDeterministicBuild))]
3939
pub unsafe extern "C" fn ZSTD_isDeterministicBuild() -> core::ffi::c_int {
4040
1
4141
}

lib/compress/zstd_compress.rs

Lines changed: 103 additions & 103 deletions
Large diffs are not rendered by default.

lib/compress/zstdmt_compress.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ unsafe fn ZSTDMT_createCCtx_advanced_internal(
16181618
}
16191619
mtctx
16201620
}
1621-
#[export_name = crate::prefix!(ZSTDMT_createCCtx_advanced)]
1621+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_createCCtx_advanced))]
16221622
pub unsafe extern "C" fn ZSTDMT_createCCtx_advanced(
16231623
mut nbWorkers: core::ffi::c_uint,
16241624
mut cMem: ZSTD_customMem,
@@ -1666,7 +1666,7 @@ unsafe fn ZSTDMT_waitForAllJobsCompleted(mut mtctx: *mut ZSTDMT_CCtx) {
16661666
(*mtctx).doneJobID;
16671667
}
16681668
}
1669-
#[export_name = crate::prefix!(ZSTDMT_freeCCtx)]
1669+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_freeCCtx))]
16701670
pub unsafe extern "C" fn ZSTDMT_freeCCtx(mut mtctx: *mut ZSTDMT_CCtx) -> size_t {
16711671
if mtctx.is_null() {
16721672
return 0;
@@ -1694,7 +1694,7 @@ pub unsafe extern "C" fn ZSTDMT_freeCCtx(mut mtctx: *mut ZSTDMT_CCtx) -> size_t
16941694
ZSTD_customFree(mtctx as *mut core::ffi::c_void, (*mtctx).cMem);
16951695
0
16961696
}
1697-
#[export_name = crate::prefix!(ZSTDMT_sizeof_CCtx)]
1697+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_sizeof_CCtx))]
16981698
pub unsafe extern "C" fn ZSTDMT_sizeof_CCtx(mut mtctx: *mut ZSTDMT_CCtx) -> size_t {
16991699
if mtctx.is_null() {
17001700
return 0;
@@ -1739,7 +1739,7 @@ unsafe fn ZSTDMT_resize(mut mtctx: *mut ZSTDMT_CCtx, mut nbWorkers: core::ffi::c
17391739
ZSTDMT_CCtxParam_setNbWorkers(&mut (*mtctx).params, nbWorkers);
17401740
0
17411741
}
1742-
#[export_name = crate::prefix!(ZSTDMT_updateCParams_whileCompressing)]
1742+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_updateCParams_whileCompressing))]
17431743
pub unsafe extern "C" fn ZSTDMT_updateCParams_whileCompressing(
17441744
mut mtctx: *mut ZSTDMT_CCtx,
17451745
mut cctxParams: *const ZSTD_CCtx_params,
@@ -1756,7 +1756,7 @@ pub unsafe extern "C" fn ZSTDMT_updateCParams_whileCompressing(
17561756
cParams.windowLog = saved_wlog;
17571757
(*mtctx).params.cParams = cParams;
17581758
}
1759-
#[export_name = crate::prefix!(ZSTDMT_getFrameProgression)]
1759+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_getFrameProgression))]
17601760
pub unsafe extern "C" fn ZSTDMT_getFrameProgression(
17611761
mut mtctx: *mut ZSTDMT_CCtx,
17621762
) -> ZSTD_frameProgression {
@@ -1806,7 +1806,7 @@ pub unsafe extern "C" fn ZSTDMT_getFrameProgression(
18061806
}
18071807
fps
18081808
}
1809-
#[export_name = crate::prefix!(ZSTDMT_toFlushNow)]
1809+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_toFlushNow))]
18101810
pub unsafe extern "C" fn ZSTDMT_toFlushNow(mut mtctx: *mut ZSTDMT_CCtx) -> size_t {
18111811
let mut toFlush: size_t = 0;
18121812
let jobID = (*mtctx).doneJobID;
@@ -1902,7 +1902,7 @@ unsafe fn ZSTDMT_computeOverlapSize(mut params: *const ZSTD_CCtx_params) -> size
19021902
(1) << ovLog
19031903
}
19041904
}
1905-
#[export_name = crate::prefix!(ZSTDMT_initCStream_internal)]
1905+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_initCStream_internal))]
19061906
pub unsafe extern "C" fn ZSTDMT_initCStream_internal(
19071907
mut mtctx: *mut ZSTDMT_CCtx,
19081908
mut dict: *const core::ffi::c_void,
@@ -2451,15 +2451,15 @@ unsafe fn findSynchronizationPoint(
24512451
}
24522452
syncPoint
24532453
}
2454-
#[export_name = crate::prefix!(ZSTDMT_nextInputSizeHint)]
2454+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_nextInputSizeHint))]
24552455
pub unsafe extern "C" fn ZSTDMT_nextInputSizeHint(mut mtctx: *const ZSTDMT_CCtx) -> size_t {
24562456
let mut hintInSize = ((*mtctx).targetSectionSize).wrapping_sub((*mtctx).inBuff.filled);
24572457
if hintInSize == 0 {
24582458
hintInSize = (*mtctx).targetSectionSize;
24592459
}
24602460
hintInSize
24612461
}
2462-
#[export_name = crate::prefix!(ZSTDMT_compressStream_generic)]
2462+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTDMT_compressStream_generic))]
24632463
pub unsafe extern "C" fn ZSTDMT_compressStream_generic(
24642464
mut mtctx: *mut ZSTDMT_CCtx,
24652465
mut output: *mut ZSTD_outBuffer,

lib/decompress/zstd_ddict.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ unsafe fn ZSTD_initDDict_internal(
170170
}
171171
0
172172
}
173-
#[export_name = crate::prefix!(ZSTD_createDDict_advanced)]
173+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_createDDict_advanced))]
174174
pub unsafe extern "C" fn ZSTD_createDDict_advanced(
175175
mut dict: *const core::ffi::c_void,
176176
mut dictSize: size_t,
@@ -198,7 +198,7 @@ pub unsafe extern "C" fn ZSTD_createDDict_advanced(
198198
}
199199
ddict
200200
}
201-
#[export_name = crate::prefix!(ZSTD_createDDict)]
201+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_createDDict))]
202202
pub unsafe extern "C" fn ZSTD_createDDict(
203203
mut dict: *const core::ffi::c_void,
204204
mut dictSize: size_t,
@@ -216,7 +216,7 @@ pub unsafe extern "C" fn ZSTD_createDDict(
216216
};
217217
ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, allocator)
218218
}
219-
#[export_name = crate::prefix!(ZSTD_createDDict_byReference)]
219+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_createDDict_byReference))]
220220
pub unsafe extern "C" fn ZSTD_createDDict_byReference(
221221
mut dictBuffer: *const core::ffi::c_void,
222222
mut dictSize: size_t,
@@ -240,7 +240,7 @@ pub unsafe extern "C" fn ZSTD_createDDict_byReference(
240240
allocator,
241241
)
242242
}
243-
#[export_name = crate::prefix!(ZSTD_initStaticDDict)]
243+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_initStaticDDict))]
244244
pub unsafe extern "C" fn ZSTD_initStaticDDict(
245245
mut sBuffer: *mut core::ffi::c_void,
246246
mut sBufferSize: size_t,
@@ -287,7 +287,7 @@ pub unsafe extern "C" fn ZSTD_initStaticDDict(
287287
}
288288
ddict
289289
}
290-
#[export_name = crate::prefix!(ZSTD_freeDDict)]
290+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_freeDDict))]
291291
pub unsafe extern "C" fn ZSTD_freeDDict(mut ddict: *mut ZSTD_DDict) -> size_t {
292292
if ddict.is_null() {
293293
return 0;
@@ -297,7 +297,7 @@ pub unsafe extern "C" fn ZSTD_freeDDict(mut ddict: *mut ZSTD_DDict) -> size_t {
297297
ZSTD_customFree(ddict as *mut core::ffi::c_void, cMem);
298298
0
299299
}
300-
#[export_name = crate::prefix!(ZSTD_estimateDDictSize)]
300+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_estimateDDictSize))]
301301
pub unsafe extern "C" fn ZSTD_estimateDDictSize(
302302
mut dictSize: size_t,
303303
mut dictLoadMethod: ZSTD_dictLoadMethod_e,
@@ -312,7 +312,7 @@ pub unsafe extern "C" fn ZSTD_estimateDDictSize(
312312
},
313313
)
314314
}
315-
#[export_name = crate::prefix!(ZSTD_sizeof_DDict)]
315+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_sizeof_DDict))]
316316
pub unsafe extern "C" fn ZSTD_sizeof_DDict(mut ddict: *const ZSTD_DDict) -> size_t {
317317
if ddict.is_null() {
318318
return 0;
@@ -325,7 +325,7 @@ pub unsafe extern "C" fn ZSTD_sizeof_DDict(mut ddict: *const ZSTD_DDict) -> size
325325
},
326326
)
327327
}
328-
#[export_name = crate::prefix!(ZSTD_getDictID_fromDDict)]
328+
#[cfg_attr(feature = "export-symbols", export_name = crate::prefix!(ZSTD_getDictID_fromDDict))]
329329
pub unsafe extern "C" fn ZSTD_getDictID_fromDDict(
330330
mut ddict: *const ZSTD_DDict,
331331
) -> core::ffi::c_uint {

0 commit comments

Comments
 (0)