From 37edcdcddebfd38cdfdb7cc5aca3a8599dc99cdd Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 7 Nov 2014 15:41:48 -0500 Subject: [PATCH] embedding: cef_string_map_clear() --- ports/cef/string_map.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ports/cef/string_map.rs b/ports/cef/string_map.rs index ddc9f52117f..feb397d89de 100644 --- a/ports/cef/string_map.rs +++ b/ports/cef/string_map.rs @@ -110,3 +110,16 @@ pub extern "C" fn cef_string_map_value(sm: *mut cef_string_map_t, index: c_int, } 0 } + +#[no_mangle] +pub extern "C" fn cef_string_map_clear(sm: *mut cef_string_map_t) { + unsafe { + if fptr_is_null(mem::transmute(sm)) { return; } + let v = string_map_to_treemap(sm); + if (*v).len() == 0 { return; } + for val in (*v).values() { + cef_string_userfree_utf8_free((*val)); + } + (*v).clear(); + } +}