mirror of
https://github.com/simonask/libyaml-safer
synced 2025-02-17 04:48:29 +00:00
Factor out IS_ASCII macro
This commit is contained in:
parent
c968eba61d
commit
7b299dfb83
2 changed files with 5 additions and 10 deletions
|
@ -1615,8 +1615,7 @@ unsafe fn yaml_emitter_analyze_scalar(
|
|||
&& !(*string.pointer.wrapping_offset(1_isize) as libc::c_int == 0xbf_i32
|
||||
&& (*string.pointer.wrapping_offset(2_isize) as libc::c_int == 0xbe_i32
|
||||
|| *string.pointer.wrapping_offset(2_isize) as libc::c_int == 0xbf_i32)))
|
||||
|| !(*string.pointer as libc::c_int <= '\u{7f}' as i32 as yaml_char_t as libc::c_int)
|
||||
&& (*emitter).unicode == 0
|
||||
|| !IS_ASCII!(string) && (*emitter).unicode == 0
|
||||
{
|
||||
special_characters = 1_i32;
|
||||
}
|
||||
|
@ -2262,9 +2261,7 @@ unsafe fn yaml_emitter_write_double_quoted_scalar(
|
|||
&& !(*string.pointer.wrapping_offset(1_isize) as libc::c_int == 0xbf_i32
|
||||
&& (*string.pointer.wrapping_offset(2_isize) as libc::c_int == 0xbe_i32
|
||||
|| *string.pointer.wrapping_offset(2_isize) as libc::c_int == 0xbf_i32)))
|
||||
|| (*emitter).unicode == 0
|
||||
&& !(*string.pointer as libc::c_int
|
||||
<= '\u{7f}' as i32 as yaml_char_t as libc::c_int)
|
||||
|| (*emitter).unicode == 0 && !IS_ASCII!(string)
|
||||
|| *string.pointer as libc::c_int == -17i32 as yaml_char_t as libc::c_int
|
||||
&& *string.pointer.wrapping_offset(1_isize) as libc::c_int
|
||||
== -69i32 as yaml_char_t as libc::c_int
|
||||
|
|
|
@ -197,12 +197,10 @@ macro_rules! AS_HEX_AT {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! IS_ASCII_AT {
|
||||
() => {}; // TODO
|
||||
}
|
||||
|
||||
macro_rules! IS_ASCII {
|
||||
() => {}; // TODO
|
||||
($string:expr) => {
|
||||
*$string.pointer as libc::c_int <= '\u{7f}' as i32 as yaml_char_t as libc::c_int
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! IS_PRINTABLE_AT {
|
||||
|
|
Loading…
Add table
Reference in a new issue