File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,13 @@ where
38
38
Ok ( ptr)
39
39
}
40
40
///
41
- /// Creates a ` NonNull` that is dangling, but well-aligned for this alignment .
41
+ /// Creates a [ NonNull] that is dangling, but well-aligned for this [Layout] .
42
42
///
43
43
/// See also [::core::alloc::Layout::dangling()]
44
44
#[ inline( always) ]
45
- pub ( crate ) const fn dangling_aligned < T > ( align : usize ) -> NonNull < T > {
45
+ pub ( crate ) const fn dangling_for_layout ( layout : & Layout ) -> NonNull < u8 > {
46
46
unsafe {
47
- let ptr = ptr:: null_mut :: < T > ( ) . byte_add ( align) ;
47
+ let ptr = ptr:: null_mut :: < u8 > ( ) . byte_add ( layout . align ( ) ) ;
48
48
NonNull :: new_unchecked ( ptr)
49
49
}
50
50
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use nginx_sys::{
8
8
ngx_pool_cleanup_add, ngx_pool_t, NGX_ALIGNMENT ,
9
9
} ;
10
10
11
- use crate :: allocator:: { dangling_aligned , AllocError , Allocator } ;
11
+ use crate :: allocator:: { dangling_for_layout , AllocError , Allocator } ;
12
12
use crate :: core:: buffer:: { Buffer , MemoryBuffer , TemporaryBuffer } ;
13
13
14
14
/// Non-owning wrapper for an [`ngx_pool_t`] pointer, providing methods for working with memory pools.
@@ -29,7 +29,7 @@ unsafe impl Allocator for Pool {
29
29
// ngx_palloc_small. Any other cases are implementation-defined, and we can't tell which
30
30
// one will be used internally.
31
31
return Ok ( NonNull :: slice_from_raw_parts (
32
- dangling_aligned ( layout. align ( ) ) ,
32
+ dangling_for_layout ( & layout) ,
33
33
layout. size ( ) ,
34
34
) ) ;
35
35
} else if layout. align ( ) == 1 {
You can’t perform that action at this time.
0 commit comments