Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions rules/time/tgt_refcount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,10 @@ fn f6(a0: Ptr<u8>, a1: usize, a2: Ptr<u8>, a3: Ptr<Tm>) -> usize {
if __text.is_empty() || __text.len() + 1 > a1 {
0
} else {
let mut __dst = a0.clone();
for __b in __text.as_bytes() {
__dst.write(*__b);
__dst += 1;
}
__dst.write(0);
a0.with_slice_mut(__text.len() + 1, |__s| {
__s[..__text.len()].copy_from_slice(__text.as_bytes());
__s[__text.len()] = 0;
});
__text.len()
}
}
Expand Down
10 changes: 4 additions & 6 deletions rules/unistd/tgt_refcount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ fn f9(a0: Ptr<u8>, a1: usize) -> i32 {
Ok(__name) => {
let __bytes = __name.as_encoded_bytes();
let __n = __bytes.len().min(a1.saturating_sub(1));
let mut __dst = a0.clone();
for __b in &__bytes[..__n] {
__dst.write(*__b);
__dst += 1;
}
if a1 > 0 {
__dst.write(0);
a0.with_slice_mut(__n + 1, |__s| {
__s[..__n].copy_from_slice(&__bytes[..__n]);
__s[__n] = 0;
});
}
0
}
Expand Down
50 changes: 20 additions & 30 deletions tests/unit/out/refcount/sys_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,10 @@ pub fn test_strftime_5() {
if __text.is_empty() || __text.len() + 1 > ::std::mem::size_of::<[u8; 64]>() {
0
} else {
let mut __dst = (buf.as_pointer() as Ptr<u8>).clone();
for __b in __text.as_bytes() {
__dst.write(*__b);
__dst += 1;
}
__dst.write(0);
(buf.as_pointer() as Ptr<u8>).with_slice_mut(__text.len() + 1, |__s| {
__s[..__text.len()].copy_from_slice(__text.as_bytes());
__s[__text.len()] = 0;
});
__text.len()
}
} > 0_usize) as i32)
Expand All @@ -210,12 +208,10 @@ pub fn test_strftime_5() {
if __text.is_empty() || __text.len() + 1 > ::std::mem::size_of::<[u8; 64]>() {
0
} else {
let mut __dst = (buf.as_pointer() as Ptr<u8>).clone();
for __b in __text.as_bytes() {
__dst.write(*__b);
__dst += 1;
}
__dst.write(0);
(buf.as_pointer() as Ptr<u8>).with_slice_mut(__text.len() + 1, |__s| {
__s[..__text.len()].copy_from_slice(__text.as_bytes());
__s[__text.len()] = 0;
});
__text.len()
}
} > 0_usize) as i32)
Expand All @@ -238,12 +234,10 @@ pub fn test_strftime_5() {
if __text.is_empty() || __text.len() + 1 > ::std::mem::size_of::<[u8; 64]>() {
0
} else {
let mut __dst = (buf.as_pointer() as Ptr<u8>).clone();
for __b in __text.as_bytes() {
__dst.write(*__b);
__dst += 1;
}
__dst.write(0);
(buf.as_pointer() as Ptr<u8>).with_slice_mut(__text.len() + 1, |__s| {
__s[..__text.len()].copy_from_slice(__text.as_bytes());
__s[__text.len()] = 0;
});
__text.len()
}
} > 0_usize) as i32)
Expand All @@ -264,12 +258,10 @@ pub fn test_strftime_5() {
if __text.is_empty() || __text.len() + 1 > ::std::mem::size_of::<[u8; 64]>() {
0
} else {
let mut __dst = (buf.as_pointer() as Ptr<u8>).clone();
for __b in __text.as_bytes() {
__dst.write(*__b);
__dst += 1;
}
__dst.write(0);
(buf.as_pointer() as Ptr<u8>).with_slice_mut(__text.len() + 1, |__s| {
__s[..__text.len()].copy_from_slice(__text.as_bytes());
__s[__text.len()] = 0;
});
__text.len()
}
} > 0_usize) as i32)
Expand All @@ -295,12 +287,10 @@ pub fn test_strftime_5() {
if __text.is_empty() || __text.len() + 1 > ::std::mem::size_of::<[u8; 4]>() {
0
} else {
let mut __dst = (small.as_pointer() as Ptr<u8>).clone();
for __b in __text.as_bytes() {
__dst.write(*__b);
__dst += 1;
}
__dst.write(0);
(small.as_pointer() as Ptr<u8>).with_slice_mut(__text.len() + 1, |__s| {
__s[..__text.len()].copy_from_slice(__text.as_bytes());
__s[__text.len()] = 0;
});
__text.len()
}
} == 0_usize) as i32)
Expand Down
Loading