Browse Source

indexer: Re-use memory buffer when reading RPM repo data

This avoids reading the entire uncompressed XML into a buffer.
Yorhel 10 months ago
parent
commit
7aa89145ca
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      indexer/src/sys_rpm.rs

+ 2
- 0
indexer/src/sys_rpm.rs View File

@@ -73,6 +73,7 @@ fn readpkgs<F>(url: String, mut cb: F) -> Result<(),Box<Error>>
73 73
     let arch_src = Some("src".to_string());
74 74
 
75 75
     loop {
76
+        buf.clear();
76 77
         let event = xml.read_event(&mut buf);
77 78
         let event = event.map_err(to_err)?;
78 79
 
@@ -141,6 +142,7 @@ fn repomd(url: String) -> Result<(String,String),Box<Error>> {
141 142
     let mut buf = Vec::new();
142 143
 
143 144
     loop {
145
+        buf.clear();
144 146
         let event = xml.read_event(&mut buf).map_err(to_err)?;
145 147
         match event {
146 148
             Event::Start(ref e) |

Loading…
Cancel
Save