diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-11 20:24:32 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-11 20:43:47 +0300 |
commit | 0c0f4468407ea9397d1e7e5d1d2d18acf1d07548 (patch) | |
tree | cccfff425b22ff84b2de6b0eee6be3a777af631c /py | |
parent | f4bf065dac9ee40e89f02115042e86c75ea3f22c (diff) | |
download | micropython-0c0f4468407ea9397d1e7e5d1d2d18acf1d07548.tar.gz micropython-0c0f4468407ea9397d1e7e5d1d2d18acf1d07548.zip |
objfun: Remove no longer used mp_obj_fun_prepare_simple_args().
Diffstat (limited to 'py')
-rw-r--r-- | py/obj.h | 2 | ||||
-rw-r--r-- | py/objfun.c | 43 |
2 files changed, 0 insertions, 45 deletions
@@ -534,8 +534,6 @@ typedef struct _mp_obj_fun_native_t { // need this so we can define const object // such functions won't be able to access the global scope, but that's probably okay } mp_obj_fun_native_t; -bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args, - uint *out_args1_len, const mp_obj_t **out_args1, uint *out_args2_len, const mp_obj_t **out_args2); const char *mp_obj_fun_get_name(mp_const_obj_t fun); const char *mp_obj_code_get_name(const byte *code_info); diff --git a/py/objfun.c b/py/objfun.c index b374fe2d20..29363129b2 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -193,49 +193,6 @@ STATIC NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, uint expected, ui #endif } -// If it's possible to call a function without allocating new argument array, -// this function returns true, together with pointers to 2 subarrays to be used -// as arguments. Otherwise, it returns false. It is expected that this function -// will be accompanied by another, mp_obj_fun_prepare_full_args(), which will -// instead take pointer to full-length out-array, and will fill it in. Rationale -// being that a caller can try this function and if it succeeds, the function call -// can be made without allocating extra memory. Otherwise, caller can allocate memory -// and try "full" function. These functions are expected to be refactoring of -// code in fun_bc_call() and eventually replace it. -bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args, - uint *out_args1_len, const mp_obj_t **out_args1, uint *out_args2_len, const mp_obj_t **out_args2) { - mp_obj_fun_bc_t *self = self_in; - DEBUG_printf("mp_obj_fun_prepare_simple_args: given: %d pos, %d kw, expected: %d pos (%d default)\n", - n_args, n_kw, self->n_pos_args, self->n_def_args); - - assert(n_kw == 0); - assert(self->n_kwonly_args == 0); - assert(self->takes_var_args == 0); - assert(self->takes_kw_args == 0); - - mp_obj_t *extra_args = self->extra_args + self->n_def_args; - uint n_extra_args = 0; - - if (n_args > self->n_pos_args) { - goto arg_error; - } else { - if (n_args >= self->n_pos_args - self->n_def_args) { - extra_args -= self->n_pos_args - n_args; - n_extra_args += self->n_pos_args - n_args; - } else { - fun_pos_args_mismatch(self, self->n_pos_args - self->n_def_args, n_args); - } - } - *out_args1 = args; - *out_args1_len = n_args; - *out_args2 = extra_args; - *out_args2_len = n_extra_args; - return true; - -arg_error: - fun_pos_args_mismatch(self, self->n_pos_args, n_args); -} - // With this macro you can tune the maximum number of function state bytes // that will be allocated on the stack. Any function that needs more // than this will use the heap. |