mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 01:46:34 +03:00
Fix warnings on variables not needing mut (#48)
chore: fix compiler warnings (unused mut)
This commit is contained in:
@@ -9,10 +9,7 @@ pub struct dc_strbuilder_t {
|
||||
pub eos: *mut libc::c_char,
|
||||
}
|
||||
|
||||
pub unsafe fn dc_strbuilder_init(
|
||||
mut strbuilder: *mut dc_strbuilder_t,
|
||||
mut init_bytes: libc::c_int,
|
||||
) {
|
||||
pub unsafe fn dc_strbuilder_init(mut strbuilder: *mut dc_strbuilder_t, init_bytes: libc::c_int) {
|
||||
if strbuilder.is_null() {
|
||||
return;
|
||||
}
|
||||
@@ -31,19 +28,19 @@ pub unsafe fn dc_strbuilder_init(
|
||||
}
|
||||
pub unsafe fn dc_strbuilder_cat(
|
||||
mut strbuilder: *mut dc_strbuilder_t,
|
||||
mut text: *const libc::c_char,
|
||||
text: *const libc::c_char,
|
||||
) -> *mut libc::c_char {
|
||||
if strbuilder.is_null() || text.is_null() {
|
||||
return 0 as *mut libc::c_char;
|
||||
}
|
||||
let mut len: libc::c_int = strlen(text) as libc::c_int;
|
||||
let len: libc::c_int = strlen(text) as libc::c_int;
|
||||
if len > (*strbuilder).free {
|
||||
let mut add_bytes: libc::c_int = if len > (*strbuilder).allocated {
|
||||
let add_bytes: libc::c_int = if len > (*strbuilder).allocated {
|
||||
len
|
||||
} else {
|
||||
(*strbuilder).allocated
|
||||
};
|
||||
let mut old_offset: libc::c_int = (*strbuilder).eos.wrapping_offset_from((*strbuilder).buf)
|
||||
let old_offset: libc::c_int = (*strbuilder).eos.wrapping_offset_from((*strbuilder).buf)
|
||||
as libc::c_long as libc::c_int;
|
||||
(*strbuilder).allocated = (*strbuilder).allocated + add_bytes;
|
||||
(*strbuilder).buf = realloc(
|
||||
@@ -56,7 +53,7 @@ pub unsafe fn dc_strbuilder_cat(
|
||||
(*strbuilder).free = (*strbuilder).free + add_bytes;
|
||||
(*strbuilder).eos = (*strbuilder).buf.offset(old_offset as isize)
|
||||
}
|
||||
let mut ret: *mut libc::c_char = (*strbuilder).eos;
|
||||
let ret: *mut libc::c_char = (*strbuilder).eos;
|
||||
strcpy((*strbuilder).eos, text);
|
||||
(*strbuilder).eos = (*strbuilder).eos.offset(len as isize);
|
||||
(*strbuilder).free -= len;
|
||||
|
||||
Reference in New Issue
Block a user