mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-30 07:10:20 +00:00
Factor out AS_DIGIT macro
This commit is contained in:
parent
ff255cac45
commit
e776070311
2 changed files with 6 additions and 12 deletions
|
@ -149,12 +149,10 @@ macro_rules! IS_DIGIT {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! AS_DIGIT_AT {
|
|
||||||
() => {}; // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! AS_DIGIT {
|
macro_rules! AS_DIGIT {
|
||||||
() => {}; // TODO
|
($string:expr) => {
|
||||||
|
*$string.pointer as libc::c_int - '0' as i32 as yaml_char_t as libc::c_int
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! IS_HEX_AT {
|
macro_rules! IS_HEX_AT {
|
||||||
|
|
|
@ -1532,9 +1532,7 @@ unsafe fn yaml_parser_scan_version_directive_number(
|
||||||
b"found extremely long version number\0" as *const u8 as *const libc::c_char,
|
b"found extremely long version number\0" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
value = value * 10_i32
|
value = value * 10_i32 + AS_DIGIT!((*parser).buffer);
|
||||||
+ (*((*parser).buffer.pointer) as libc::c_int
|
|
||||||
- '0' as i32 as yaml_char_t as libc::c_int);
|
|
||||||
SKIP!(parser);
|
SKIP!(parser);
|
||||||
if CACHE!(parser, 1_u64) == 0 {
|
if CACHE!(parser, 1_u64) == 0 {
|
||||||
return 0_i32;
|
return 0_i32;
|
||||||
|
@ -2323,8 +2321,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
||||||
);
|
);
|
||||||
current_block = 14984465786483313892;
|
current_block = 14984465786483313892;
|
||||||
} else {
|
} else {
|
||||||
increment = *((*parser).buffer.pointer) as libc::c_int
|
increment = AS_DIGIT!((*parser).buffer);
|
||||||
- '0' as i32 as yaml_char_t as libc::c_int;
|
|
||||||
SKIP!(parser);
|
SKIP!(parser);
|
||||||
current_block = 11913429853522160501;
|
current_block = 11913429853522160501;
|
||||||
}
|
}
|
||||||
|
@ -2345,8 +2342,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
||||||
);
|
);
|
||||||
current_block = 14984465786483313892;
|
current_block = 14984465786483313892;
|
||||||
} else {
|
} else {
|
||||||
increment = *((*parser).buffer.pointer) as libc::c_int
|
increment = AS_DIGIT!((*parser).buffer);
|
||||||
- '0' as i32 as yaml_char_t as libc::c_int;
|
|
||||||
SKIP!(parser);
|
SKIP!(parser);
|
||||||
if CACHE!(parser, 1_u64) == 0 {
|
if CACHE!(parser, 1_u64) == 0 {
|
||||||
current_block = 14984465786483313892;
|
current_block = 14984465786483313892;
|
||||||
|
|
Loading…
Reference in a new issue