File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,17 @@ mp_map_t *mp_map_new(int n) {
4040 return map ;
4141}
4242
43+ // Differentiate from mp_map_clear() - semantics is different
44+ void mp_map_deinit (mp_map_t * map ) {
45+ m_del (mp_map_elem_t , map -> table , map -> alloc );
46+ map -> used = map -> alloc = 0 ;
47+ }
48+
49+ void mp_map_free (mp_map_t * map ) {
50+ mp_map_deinit (map );
51+ m_del_obj (mp_map_t , map );
52+ }
53+
4354void mp_map_clear (mp_map_t * map ) {
4455 map -> used = 0 ;
4556 map -> all_keys_are_qstrs = 1 ;
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ typedef enum _mp_map_lookup_kind_t {
2828int get_doubling_prime_greater_or_equal_to (int x );
2929void mp_map_init (mp_map_t * map , int n );
3030mp_map_t * mp_map_new (int n );
31+ void mp_map_deinit (mp_map_t * map );
32+ void mp_map_free (mp_map_t * map );
3133mp_map_elem_t * mp_map_lookup (mp_map_t * map , mp_obj_t index , mp_map_lookup_kind_t lookup_kind );
3234void mp_map_clear (mp_map_t * map );
3335
You can’t perform that action at this time.
0 commit comments