mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-23 03:43:03 +00:00
Factor out IS_TAB macro
This commit is contained in:
parent
c0143fb033
commit
6893ddc2b0
2 changed files with 10 additions and 8 deletions
|
@ -251,19 +251,23 @@ macro_rules! IS_SPACE {
|
|||
}
|
||||
|
||||
macro_rules! IS_TAB_AT {
|
||||
() => {}; // TODO
|
||||
($string:expr, $offset:expr) => {
|
||||
*$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_TAB {
|
||||
() => {}; // TODO
|
||||
($string:expr) => {
|
||||
IS_TAB_AT!($string, 0)
|
||||
};
|
||||
}
|
||||
|
||||
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
|
||||
|| IS_TAB_AT!($string, $offset)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2416,8 +2416,7 @@ unsafe fn yaml_parser_scan_block_scalar_breaks(
|
|||
max_indent = (*parser).mark.column as libc::c_int;
|
||||
}
|
||||
if (*indent == 0 || ((*parser).mark.column as libc::c_int) < *indent)
|
||||
&& *((*parser).buffer.pointer) as libc::c_int
|
||||
== '\t' as i32 as yaml_char_t as libc::c_int
|
||||
&& IS_TAB!((*parser).buffer)
|
||||
{
|
||||
return yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
|
@ -3132,8 +3131,7 @@ unsafe fn yaml_parser_scan_plain_scalar(
|
|||
if IS_BLANK!((*parser).buffer) {
|
||||
if leading_blanks != 0
|
||||
&& ((*parser).mark.column as libc::c_int) < indent
|
||||
&& *((*parser).buffer.pointer) as libc::c_int
|
||||
== '\t' as i32 as yaml_char_t as libc::c_int
|
||||
&& IS_TAB!((*parser).buffer)
|
||||
{
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
|
|
Loading…
Reference in a new issue