Make dc_get_config_t safe

This commit is contained in:
Alexander Krotov
2019-07-28 23:42:38 +03:00
parent 669ed0e0df
commit 3f445a3a6c
3 changed files with 13 additions and 32 deletions

View File

@@ -254,16 +254,8 @@ unsafe fn cb_set_config(context: &Context, key: *const libc::c_char, value: *con
*
* @private @memberof Context
*/
unsafe fn cb_get_config(
context: &Context,
key: *const libc::c_char,
def: *const libc::c_char,
) -> *mut libc::c_char {
let res = context
.sql
.get_config(context, as_str(key))
.unwrap_or_else(|| to_string(def));
to_cstring(res)
fn cb_get_config(context: &Context, key: &str) -> Option<String> {
context.sql.get_config(context, key)
}
pub unsafe fn dc_context_unref(context: &mut Context) {