Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
efa62902
Commit
efa62902
authored
Feb 16, 2017
by
Damien George
Browse files
py/objclosure: Convert mp_uint_t to size_t where appropriate.
parent
dbcdb9f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/obj.h
View file @
efa62902
...
...
@@ -629,7 +629,7 @@ mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const
mp_obj_t
mp_obj_new_fun_viper
(
size_t
n_args
,
void
*
fun_data
,
mp_uint_t
type_sig
);
mp_obj_t
mp_obj_new_fun_asm
(
size_t
n_args
,
void
*
fun_data
,
mp_uint_t
type_sig
);
mp_obj_t
mp_obj_new_gen_wrap
(
mp_obj_t
fun
);
mp_obj_t
mp_obj_new_closure
(
mp_obj_t
fun
,
mp_uint
_t
n_closed
,
const
mp_obj_t
*
closed
);
mp_obj_t
mp_obj_new_closure
(
mp_obj_t
fun
,
size
_t
n_closed
,
const
mp_obj_t
*
closed
);
mp_obj_t
mp_obj_new_tuple
(
size_t
n
,
const
mp_obj_t
*
items
);
mp_obj_t
mp_obj_new_list
(
size_t
n
,
mp_obj_t
*
items
);
mp_obj_t
mp_obj_new_dict
(
size_t
n_args
);
...
...
py/objclosure.c
View file @
efa62902
...
...
@@ -32,7 +32,7 @@
typedef
struct
_mp_obj_closure_t
{
mp_obj_base_t
base
;
mp_obj_t
fun
;
mp_uint
_t
n_closed
;
size
_t
n_closed
;
mp_obj_t
closed
[];
}
mp_obj_closure_t
;
...
...
@@ -41,7 +41,7 @@ STATIC mp_obj_t closure_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
// need to concatenate closed-over-vars and args
mp_uint
_t
n_total
=
self
->
n_closed
+
n_args
+
2
*
n_kw
;
size
_t
n_total
=
self
->
n_closed
+
n_args
+
2
*
n_kw
;
if
(
n_total
<=
5
)
{
// use stack to allocate temporary args array
mp_obj_t
args2
[
5
];
...
...
@@ -66,7 +66,7 @@ STATIC void closure_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_
mp_print_str
(
print
,
"<closure "
);
mp_obj_print_helper
(
print
,
o
->
fun
,
PRINT_REPR
);
mp_printf
(
print
,
" at %p, n_closed=%u "
,
o
,
(
int
)
o
->
n_closed
);
for
(
mp_uint
_t
i
=
0
;
i
<
o
->
n_closed
;
i
++
)
{
for
(
size
_t
i
=
0
;
i
<
o
->
n_closed
;
i
++
)
{
if
(
o
->
closed
[
i
]
==
MP_OBJ_NULL
)
{
mp_print_str
(
print
,
"(nil)"
);
}
else
{
...
...
@@ -87,7 +87,7 @@ const mp_obj_type_t closure_type = {
.
call
=
closure_call
,
};
mp_obj_t
mp_obj_new_closure
(
mp_obj_t
fun
,
mp_uint
_t
n_closed_over
,
const
mp_obj_t
*
closed
)
{
mp_obj_t
mp_obj_new_closure
(
mp_obj_t
fun
,
size
_t
n_closed_over
,
const
mp_obj_t
*
closed
)
{
mp_obj_closure_t
*
o
=
m_new_obj_var
(
mp_obj_closure_t
,
mp_obj_t
,
n_closed_over
);
o
->
base
.
type
=
&
closure_type
;
o
->
fun
=
fun
;
...
...
Write
Preview
Supports
Markdown
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