Factor out IS_TAB macro

This commit is contained in:
David Tolnay 2022-07-22 18:17:47 -07:00
parent c0143fb033
commit 6893ddc2b0
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
2 changed files with 10 additions and 8 deletions

View file

@ -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)
};
}

View file

@ -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,