mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Remove to_cstring() naming convention ambiguity
Add a trait for str.strdup() to replace to_cstring() which avoid the signature ambiguity with .to_string(). Also instruduce CString::yolo() as a shortcut to CString::new().unwrap() and use it whenever the variable does can be deallocated by going out of scope. This is less error prone. Use some Path.to_c_string() functions where possible.
This commit is contained in:
committed by
Floris Bruynooghe
parent
e7428887d0
commit
b6b0849bce
@@ -10,7 +10,6 @@ use crate::dc_tools::*;
|
||||
use crate::error::{Error, Result};
|
||||
use crate::param::*;
|
||||
use crate::peerstate::*;
|
||||
use crate::x::*;
|
||||
|
||||
const DC_OPEN_READONLY: usize = 0x01;
|
||||
|
||||
@@ -1049,9 +1048,8 @@ pub fn housekeeping(context: &Context) {
|
||||
entry.file_name()
|
||||
);
|
||||
unsafe {
|
||||
let path = to_cstring(entry.path().to_str().unwrap());
|
||||
dc_delete_file(context, path);
|
||||
free(path as *mut _);
|
||||
let path = entry.path().to_c_string().unwrap();
|
||||
dc_delete_file(context, path.as_ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user