mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-26 21:30:24 +00:00
Factor out IS_BLANK_AT macro
This commit is contained in:
parent
f3bd6b6376
commit
ee0a40afc5
2 changed files with 13 additions and 11 deletions
|
@ -1,16 +1,21 @@
|
|||
macro_rules! IS_BLANK_AT {
|
||||
($string:expr, $offset:expr) => {
|
||||
*$string.pointer.wrapping_offset($offset as isize) as libc::c_int
|
||||
== ' ' as i32 as yaml_char_t as libc::c_int
|
||||
|| *$string.pointer.wrapping_offset($offset as isize) as libc::c_int
|
||||
== '\t' as i32 as yaml_char_t as libc::c_int
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! IS_BLANK {
|
||||
($string:expr) => {
|
||||
*$string.pointer as libc::c_int == ' ' as i32 as yaml_char_t as libc::c_int
|
||||
|| *$string.pointer as libc::c_int == '\t' as i32 as yaml_char_t as libc::c_int
|
||||
IS_BLANK_AT!($string, 0)
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! IS_BLANKZ_AT {
|
||||
($string:expr, $offset:expr) => {
|
||||
(*$string.pointer.wrapping_offset($offset as isize) as libc::c_int
|
||||
== ' ' as i32 as yaml_char_t as libc::c_int
|
||||
|| *$string.pointer.wrapping_offset($offset as isize) as libc::c_int
|
||||
== '\t' as i32 as yaml_char_t as libc::c_int
|
||||
IS_BLANK_AT!($string, $offset)
|
||||
|| (*$string.pointer.wrapping_offset($offset as isize) as libc::c_int
|
||||
== '\r' as i32 as yaml_char_t as libc::c_int
|
||||
|| *$string.pointer.wrapping_offset($offset as isize) as libc::c_int
|
||||
|
@ -32,7 +37,7 @@ macro_rules! IS_BLANKZ_AT {
|
|||
&& *$string.pointer.wrapping_offset($offset as isize + 2) as libc::c_int
|
||||
== -87i32 as yaml_char_t as libc::c_int
|
||||
|| *$string.pointer.wrapping_offset($offset as isize) as libc::c_int
|
||||
== '\0' as i32 as yaml_char_t as libc::c_int))
|
||||
== '\0' as i32 as yaml_char_t as libc::c_int)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -476,10 +476,7 @@ unsafe fn yaml_parser_fetch_next_token(parser: *mut yaml_parser_t) -> libc::c_in
|
|||
|| *((*parser).buffer.pointer) as libc::c_int == '@' as i32 as yaml_char_t as libc::c_int
|
||||
|| *((*parser).buffer.pointer) as libc::c_int == '`' as i32 as yaml_char_t as libc::c_int)
|
||||
|| *((*parser).buffer.pointer) as libc::c_int == '-' as i32 as yaml_char_t as libc::c_int
|
||||
&& !(*((*parser).buffer.pointer).wrapping_offset(1_isize) as libc::c_int
|
||||
== ' ' as i32 as yaml_char_t as libc::c_int
|
||||
|| *((*parser).buffer.pointer).wrapping_offset(1_isize) as libc::c_int
|
||||
== '\t' as i32 as yaml_char_t as libc::c_int)
|
||||
&& !IS_BLANK_AT!((*parser).buffer, 1)
|
||||
|| (*parser).flow_level == 0
|
||||
&& (*((*parser).buffer.pointer) as libc::c_int
|
||||
== '?' as i32 as yaml_char_t as libc::c_int
|
||||
|
|
Loading…
Reference in a new issue