Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
circuitpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
circuitpython
Commits
9a24a046
Commit
9a24a046
authored
Jan 25, 2014
by
Paul Sokolovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mp_map_deinit() & mp_map_free() to finalize maps.
mp_map_deinit() finalizes static map, mp_map_free() - dynamic.
parent
fcd4ae82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
py/map.c
py/map.c
+11
-0
py/map.h
py/map.h
+2
-0
No files found.
py/map.c
View file @
9a24a046
...
...
@@ -40,6 +40,17 @@ mp_map_t *mp_map_new(int n) {
return
map
;
}
// Differentiate from mp_map_clear() - semantics is different
void
mp_map_deinit
(
mp_map_t
*
map
)
{
m_del
(
mp_map_elem_t
,
map
->
table
,
map
->
alloc
);
map
->
used
=
map
->
alloc
=
0
;
}
void
mp_map_free
(
mp_map_t
*
map
)
{
mp_map_deinit
(
map
);
m_del_obj
(
mp_map_t
,
map
);
}
void
mp_map_clear
(
mp_map_t
*
map
)
{
map
->
used
=
0
;
map
->
all_keys_are_qstrs
=
1
;
...
...
py/map.h
View file @
9a24a046
...
...
@@ -28,6 +28,8 @@ typedef enum _mp_map_lookup_kind_t {
int
get_doubling_prime_greater_or_equal_to
(
int
x
);
void
mp_map_init
(
mp_map_t
*
map
,
int
n
);
mp_map_t
*
mp_map_new
(
int
n
);
void
mp_map_deinit
(
mp_map_t
*
map
);
void
mp_map_free
(
mp_map_t
*
map
);
mp_map_elem_t
*
mp_map_lookup
(
mp_map_t
*
map
,
mp_obj_t
index
,
mp_map_lookup_kind_t
lookup_kind
);
void
mp_map_clear
(
mp_map_t
*
map
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment