File tree 3 files changed +32
-8
lines changed 3 files changed +32
-8
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,13 @@ macro_rules! syscall1 {
35
35
#[ macro_export]
36
36
macro_rules! hprint {
37
37
( $( $tt: tt) * ) => {
38
- $crate:: export:: hstdout_fmt( format_args!( $( $tt) * ) )
38
+ match :: core:: format_args!( $( $tt) * ) {
39
+ args => if let :: core:: option:: Option :: Some ( s) = args. as_str( ) {
40
+ $crate:: export:: hstdout_str( s)
41
+ } else {
42
+ $crate:: export:: hstdout_fmt( args)
43
+ } ,
44
+ }
39
45
} ;
40
46
}
41
47
@@ -45,7 +51,7 @@ macro_rules! hprint {
45
51
#[ macro_export]
46
52
macro_rules! hprintln {
47
53
( $( $tt: tt) * ) => {
48
- match $crate:: export :: hstdout_fmt ( format_args !( $( $tt) * ) ) {
54
+ match $crate:: hprint !( $( $tt) * ) {
49
55
Ok ( ( ) ) => $crate:: export:: hstdout_str( "\n " ) ,
50
56
Err ( ( ) ) => Err ( ( ) ) ,
51
57
}
@@ -58,7 +64,13 @@ macro_rules! hprintln {
58
64
#[ macro_export]
59
65
macro_rules! heprint {
60
66
( $( $tt: tt) * ) => {
61
- $crate:: export:: hstderr_fmt( format_args!( $( $tt) * ) )
67
+ match :: core:: format_args!( $( $tt) * ) {
68
+ args => if let :: core:: option:: Option :: Some ( s) = args. as_str( ) {
69
+ $crate:: export:: hstderr_str( s)
70
+ } else {
71
+ $crate:: export:: hstderr_fmt( args)
72
+ } ,
73
+ }
62
74
} ;
63
75
}
64
76
@@ -68,7 +80,7 @@ macro_rules! heprint {
68
80
#[ macro_export]
69
81
macro_rules! heprintln {
70
82
( $( $tt: tt) * ) => {
71
- match $crate:: export :: hstderr_fmt ( format_args !( $( $tt) * ) ) {
83
+ match $crate:: heprint !( $( $tt) * ) {
72
84
Ok ( ( ) ) => $crate:: export:: hstderr_str( "\n " ) ,
73
85
Err ( ( ) ) => Err ( ( ) ) ,
74
86
}
Original file line number Diff line number Diff line change @@ -106,15 +106,21 @@ pub fn write_fmt(args: fmt::Arguments<'_>) {
106
106
#[ macro_export]
107
107
macro_rules! sprint {
108
108
( $( $tt: tt) * ) => {
109
- $crate:: stdout:: write_fmt( format_args!( $( $tt) * ) )
109
+ match :: core:: format_args!( $( $tt) * ) {
110
+ args => if let :: core:: option:: Option :: Some ( s) = args. as_str( ) {
111
+ $crate:: stdout:: write_str( s)
112
+ } else {
113
+ $crate:: stdout:: write_fmt( args)
114
+ } ,
115
+ }
110
116
} ;
111
117
}
112
118
113
119
/// Macro for printing to the serial standard output, with a newline.
114
120
#[ macro_export]
115
121
macro_rules! sprintln {
116
122
( $( $tt: tt) * ) => { {
117
- $crate:: stdout :: write_fmt ( format_args !( $( $tt) * ) ) ;
123
+ $crate:: sprint !( $( $tt) * ) ;
118
124
$crate:: stdout:: write_str( "\n " ) ;
119
125
} } ;
120
126
}
Original file line number Diff line number Diff line change @@ -102,15 +102,21 @@ pub fn write_fmt(args: fmt::Arguments<'_>) {
102
102
#[ macro_export]
103
103
macro_rules! sprint {
104
104
( $( $tt: tt) * ) => {
105
- $crate:: stdout:: write_fmt( format_args!( $( $tt) * ) )
105
+ match :: core:: format_args!( $( $tt) * ) {
106
+ args => if let :: core:: option:: Option :: Some ( s) = args. as_str( ) {
107
+ $crate:: stdout:: write_str( s)
108
+ } else {
109
+ $crate:: stdout:: write_fmt( args)
110
+ } ,
111
+ }
106
112
} ;
107
113
}
108
114
109
115
/// Macro for printing to the serial standard output, with a newline.
110
116
#[ macro_export]
111
117
macro_rules! sprintln {
112
118
( $( $tt: tt) * ) => { {
113
- $crate:: stdout :: write_fmt ( format_args !( $( $tt) * ) ) ;
119
+ $crate:: sprint !( $( $tt) * ) ;
114
120
$crate:: stdout:: write_str( "\n " ) ;
115
121
} } ;
116
122
}
You can’t perform that action at this time.
0 commit comments