File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change
1
+ # Upcoming Release
2
+
3
+ ## Added
4
+
5
+ - Added ` FdtWriter::property_cstring ` method to allow setting ` &CStr ` string
6
+ value directly.
7
+
8
+ ## Fixed
9
+
1
10
# v0.3.0
2
11
3
12
## Added
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use alloc::string::String;
10
10
use alloc:: vec:: Vec ;
11
11
use core:: cmp:: { Ord , Ordering } ;
12
12
use core:: convert:: TryInto ;
13
+ use core:: ffi:: CStr ;
13
14
use core:: fmt;
14
15
use core:: mem:: size_of_val;
15
16
#[ cfg( feature = "std" ) ]
@@ -448,7 +449,12 @@ impl FdtWriter {
448
449
/// Write a string property.
449
450
pub fn property_string ( & mut self , name : & str , val : & str ) -> Result < ( ) > {
450
451
let cstr_value = CString :: new ( val) . map_err ( |_| Error :: InvalidString ) ?;
451
- self . property ( name, cstr_value. to_bytes_with_nul ( ) )
452
+ self . property_cstring ( name, & cstr_value)
453
+ }
454
+
455
+ /// Write a C string property.
456
+ pub fn property_cstring ( & mut self , name : & str , val : & CStr ) -> Result < ( ) > {
457
+ self . property ( name, val. to_bytes_with_nul ( ) )
452
458
}
453
459
454
460
/// Write a stringlist property.
You can’t perform that action at this time.
0 commit comments