Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
0f5e8b15
Commit
0f5e8b15
authored
Jan 25, 2014
by
Damien George
Browse files
Merge branch 'master' of github.com:micropython/micropython
parents
7c9c6676
c1d200ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/map.c
View file @
0f5e8b15
...
...
@@ -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 @
0f5e8b15
...
...
@@ -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
);
...
...
py/runtime.c
View file @
0f5e8b15
...
...
@@ -166,6 +166,7 @@ void rt_init(void) {
mp_module_micropython_init
();
// TODO: wastes one mp_code_t structure in mem
next_unique_code_id
=
1
;
// 0 indicates "no code"
unique_codes_alloc
=
0
;
unique_codes
=
NULL
;
...
...
@@ -177,6 +178,9 @@ void rt_init(void) {
void
rt_deinit
(
void
)
{
m_del
(
mp_code_t
,
unique_codes
,
unique_codes_alloc
);
mp_map_free
(
map_globals
);
mp_map_deinit
(
&
map_loaded_modules
);
mp_map_deinit
(
&
map_builtins
);
#ifdef WRITE_CODE
if
(
fp_write_code
!=
NULL
)
{
fclose
(
fp_write_code
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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