Make the naming of variables more obvious.

This commit is contained in:
nwin 2015-02-23 10:00:58 +01:00
parent 1ab1f3f320
commit 586c7dd30b
2 changed files with 6 additions and 4 deletions

View File

@ -64,10 +64,11 @@ impl Attribute {
let mut names = Vec::new(); let mut names = Vec::new();
let mut start = 0; let mut start = 0;
for end in idx { for end in idx {
let c_end = end + 1; // end of the c-string (including 0)
let size = unsafe { let size = unsafe {
getxattr( getxattr(
c_path.as_ptr(), c_path.as_ptr(),
buf[start..end+1].as_ptr() as *const c_char, buf[start..c_end].as_ptr() as *const c_char,
ptr::null_mut(), 0, 0, c_flags ptr::null_mut(), 0, 0, c_flags
) )
}; };
@ -81,7 +82,7 @@ impl Attribute {
size: size as usize size: size as usize
}); });
} }
start = end + 1; start = c_end;
} }
Ok(names) Ok(names)
} else { } else {

View File

@ -59,10 +59,11 @@ impl Attribute {
let mut names = Vec::new(); let mut names = Vec::new();
let mut start = 0; let mut start = 0;
for end in idx { for end in idx {
let c_end = end + 1; // end of the c-string (including 0)
let size = unsafe { let size = unsafe {
getxattr( getxattr(
c_path.as_ptr(), c_path.as_ptr(),
buf[start..end+1].as_ptr() as *const c_char, buf[start..c_end].as_ptr() as *const c_char,
ptr::null_mut(), 0 ptr::null_mut(), 0
) )
}; };
@ -72,7 +73,7 @@ impl Attribute {
size: size as usize size: size as usize
}); });
} }
start = end + 1; start = c_end;
} }
Ok(names) Ok(names)
} else { } else {