Skip to content

Commit 734d15a

Browse files
committed
Use Tokenizer more.
1 parent 0c541bf commit 734d15a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

samply-symbols/src/breakpad/index.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -543,18 +543,17 @@ pub struct BreakpadFuncSymbol {
543543

544544
impl BreakpadFuncSymbol {
545545
pub fn parse<'a, 'b>(
546-
mut input: &'a [u8],
546+
input: &'a [u8],
547547
lines: &'b mut Vec<SourceLine>,
548548
inlinees: &'b mut Vec<Inlinee>,
549549
) -> Result<BreakpadFuncSymbolInfo<'a>, BreakpadParseError> {
550-
let first_line = read_line_and_advance(&mut input);
550+
let mut tokenizer = Tokenizer::new(input);
551551
let (_address, size, name) =
552-
func_line(first_line).map_err(|_| BreakpadParseError::ParsingFunc)?;
552+
func_line(&mut tokenizer).map_err(|_| BreakpadParseError::ParsingFunc)?;
553553

554554
let lines_start_index = lines.len();
555555
let inlinees_start_index = inlinees.len();
556556

557-
let mut tokenizer = Tokenizer::new(input);
558557
while !tokenizer.eof() {
559558
if tokenizer.consume_token(b"INLINE").is_ok() {
560559
parse_inline_line_remainder(&mut tokenizer, inlinees)
@@ -662,7 +661,7 @@ impl BreakpadIndexCreatorInner {
662661
line_or_block_len: line_len.into(),
663662
},
664663
));
665-
} else if let Ok((address, _size, _name)) = func_line(input) {
664+
} else if let Ok((address, _size, _name)) = func_line(&mut Tokenizer::new(input)) {
666665
self.finish_pending_func_block(file_offset);
667666
self.pending_func_block = Some((address, file_offset));
668667
} else if input.starts_with(b"INFO ") {
@@ -1113,8 +1112,7 @@ fn parse_func_data_line(tokenizer: &mut Tokenizer) -> Result<SourceLine, ()> {
11131112
}
11141113

11151114
// Matches a FUNC record.
1116-
fn func_line(input: &[u8]) -> Result<(u32, u32, &[u8]), ()> {
1117-
let mut tokenizer = Tokenizer::new(input);
1115+
fn func_line<'a>(tokenizer: &mut Tokenizer<'a>) -> Result<(u32, u32, &'a [u8]), ()> {
11181116
tokenizer.consume_token(b"FUNC")?;
11191117
tokenizer.consume_space1()?;
11201118
if let Ok(()) = tokenizer.consume_token(b"m") {

0 commit comments

Comments
 (0)