Merge pull request #252 from link2xt/dc_get_config-safe

Make dc_get_config_t safe
This commit is contained in:
Friedel Ziegelmayer
2019-07-30 00:25:29 +02:00
committed by GitHub
3 changed files with 13 additions and 32 deletions

View File

@@ -249,16 +249,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) {