File tree 1 file changed +5
-4
lines changed 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ use crate::c_types::c_int;
18
18
#[ doc( hidden) ]
19
19
pub mod format_strings {
20
20
use crate :: bindings;
21
+ use crate :: build_assert;
21
22
22
23
/// The length we copy from the `KERN_*` kernel prefixes.
23
24
const LENGTH_PREFIX : usize = 2 ;
@@ -33,13 +34,13 @@ pub mod format_strings {
33
34
/// [`printk`]: ../../../../include/linux/printk.h
34
35
const fn generate ( is_cont : bool , prefix : & [ u8 ; 3 ] ) -> [ u8 ; LENGTH ] {
35
36
// Ensure the `KERN_*` macros are what we expect.
36
- assert ! ( prefix[ 0 ] == b'\x01' ) ;
37
+ build_assert ! ( prefix[ 0 ] == b'\x01' ) ;
37
38
if is_cont {
38
- assert ! ( prefix[ 1 ] == b'c' ) ;
39
+ build_assert ! ( prefix[ 1 ] == b'c' ) ;
39
40
} else {
40
- assert ! ( prefix[ 1 ] >= b'0' && prefix[ 1 ] <= b'7' ) ;
41
+ build_assert ! ( prefix[ 1 ] >= b'0' && prefix[ 1 ] <= b'7' ) ;
41
42
}
42
- assert ! ( prefix[ 2 ] == b'\x00' ) ;
43
+ build_assert ! ( prefix[ 2 ] == b'\x00' ) ;
43
44
44
45
let suffix: & [ u8 ; LENGTH - LENGTH_PREFIX ] = if is_cont {
45
46
b"%.*s\0 \0 \0 \0 \0 "
You can’t perform that action at this time.
0 commit comments