Skip to content

Commit 0365227

Browse files
Copilotnunoplopes
andauthored
Replace ptr = ptr.offset(1) increment patterns with in-place pointer arithmetic (#96)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Nuno Lopes <nuno.lopes@tecnico.ulisboa.pt>
1 parent 759011e commit 0365227

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

libcc2rs/src/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn fread_refcount(a0: AnyPtr, a1: u64, a2: u64, a3: Ptr<::std::fs::File>) ->
112112

113113
for &byte in &buffer[..n] {
114114
dst.write(byte);
115-
dst = dst.offset(1);
115+
dst += 1;
116116
}
117117

118118
read_bytes += n;

libcc2rs/src/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ impl<T> Iterator for StringIterator<T> {
641641
// skip the null terminator
642642
if self.ptr.get_offset() + 1 < self.ptr.len() {
643643
let value = self.ptr.clone();
644-
self.ptr = self.ptr.offset(1);
644+
self.ptr += 1;
645645
Some(value)
646646
} else {
647647
None

0 commit comments

Comments
 (0)