Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
efa62902
Commit
efa62902
authored
Feb 16, 2017
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py/objclosure: Convert mp_uint_t to size_t where appropriate.
parent
dbcdb9f8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
py/obj.h
+1
-1
1 addition, 1 deletion
py/obj.h
py/objclosure.c
+4
-4
4 additions, 4 deletions
py/objclosure.c
with
5 additions
and
5 deletions
py/obj.h
+
1
−
1
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
...
@@ -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_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_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_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_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_list
(
size_t
n
,
mp_obj_t
*
items
);
mp_obj_t
mp_obj_new_dict
(
size_t
n_args
);
mp_obj_t
mp_obj_new_dict
(
size_t
n_args
);
...
...
This diff is collapsed.
Click to expand it.
py/objclosure.c
+
4
−
4
View file @
efa62902
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
typedef
struct
_mp_obj_closure_t
{
typedef
struct
_mp_obj_closure_t
{
mp_obj_base_t
base
;
mp_obj_base_t
base
;
mp_obj_t
fun
;
mp_obj_t
fun
;
mp_uint
_t
n_closed
;
size
_t
n_closed
;
mp_obj_t
closed
[];
mp_obj_t
closed
[];
}
mp_obj_closure_t
;
}
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
...
@@ -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
// 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
)
{
if
(
n_total
<=
5
)
{
// use stack to allocate temporary args array
// use stack to allocate temporary args array
mp_obj_t
args2
[
5
];
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_
...
@@ -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_print_str
(
print
,
"<closure "
);
mp_obj_print_helper
(
print
,
o
->
fun
,
PRINT_REPR
);
mp_obj_print_helper
(
print
,
o
->
fun
,
PRINT_REPR
);
mp_printf
(
print
,
" at %p, n_closed=%u "
,
o
,
(
int
)
o
->
n_closed
);
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
)
{
if
(
o
->
closed
[
i
]
==
MP_OBJ_NULL
)
{
mp_print_str
(
print
,
"(nil)"
);
mp_print_str
(
print
,
"(nil)"
);
}
else
{
}
else
{
...
@@ -87,7 +87,7 @@ const mp_obj_type_t closure_type = {
...
@@ -87,7 +87,7 @@ const mp_obj_type_t closure_type = {
.
call
=
closure_call
,
.
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
);
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
->
base
.
type
=
&
closure_type
;
o
->
fun
=
fun
;
o
->
fun
=
fun
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment