Avoid static muts for static pool buffer declaration #215

Merged
muellerr merged 3 commits from avoid-static-muts-static-pools into main 2025-01-31 12:12:57 +01:00
Showing only changes of commit af972e174f - Show all commits

View File

@ -434,18 +434,18 @@ pub mod heapless_mod {
#[macro_export]
macro_rules! static_subpool {
($pool_name: ident, $sizes_list_name: ident, $num_blocks: expr, $block_size: expr) => {
static $pool_name: satrs::pool::UnsafeCellBufWrapper<[u8; $num_blocks * $block_size]> =
satrs::pool::UnsafeCellBufWrapper::new([0; $num_blocks * $block_size]);
static $sizes_list_name: UnsafeCellBufWrapper<[usize; $num_blocks]> =
satrs::pool::UnsafeCellBufWrapper::new([$crate::pool::STORE_FREE; $num_blocks]);
static $pool_name: $crate::pool::UnsafeCellBufWrapper<[u8; $num_blocks * $block_size]> =
$crate::pool::UnsafeCellBufWrapper::new([0; $num_blocks * $block_size]);
static $sizes_list_name: $crate::pool::UnsafeCellBufWrapper<[usize; $num_blocks]> =
$crate::pool::UnsafeCellBufWrapper::new([$crate::pool::STORE_FREE; $num_blocks]);
};
($pool_name: ident, $sizes_list_name: ident, $num_blocks: expr, $block_size: expr, $meta_data: meta) => {
#[$meta_data]
static $pool_name: satrs::pool::UnsafeCellBufWrapper<[u8; $num_blocks * $block_size]> =
satrs::pool::UnsafeCellBufWrapper::new([0; $num_blocks * $block_size]);
static $pool_name: $crate::pool::UnsafeCellBufWrapper<[u8; $num_blocks * $block_size]> =
$crate::pool::UnsafeCellBufWrapper::new([0; $num_blocks * $block_size]);
#[$meta_data]
static $sizes_list_name: satrs::pool::UnsafeCellBufWrapper<[usize; $num_blocks]> =
satrs::pool::UnsafeCellBufWrapper::new([$crate::pool::STORE_FREE; $num_blocks]);
static $sizes_list_name: $crate::pool::UnsafeCellBufWrapper<[usize; $num_blocks]> =
$crate::pool::UnsafeCellBufWrapper::new([$crate::pool::STORE_FREE; $num_blocks]);
};
}