moduzlib: Fix fn prototype and some code style; use it in stmhal port.

This commit is contained in:
Damien George 2014-10-12 23:35:38 +01:00
parent 29f5682621
commit 4b71c056ef
3 changed files with 7 additions and 5 deletions

View File

@ -48,8 +48,7 @@
#define DEBUG_printf(...) (void)0 #define DEBUG_printf(...) (void)0
#endif #endif
STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req) STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req) {
{
if (alloc_req < 256) { if (alloc_req < 256) {
alloc_req = 256; alloc_req = 256;
} }
@ -59,7 +58,7 @@ STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req)
return 0; return 0;
} }
STATIC mp_obj_t mod_uzlib_decompress(uint n_args, mp_obj_t *args) { STATIC mp_obj_t mod_uzlib_decompress(mp_uint_t n_args, const mp_obj_t *args) {
mp_obj_t data = args[0]; mp_obj_t data = args[0];
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ); mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);

View File

@ -57,7 +57,7 @@
#define MICROPY_PY_IO (1) #define MICROPY_PY_IO (1)
#define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_IO_FILEIO (1)
#define MICROPY_PY_UCTYPES (1) #define MICROPY_PY_UCTYPES (1)
#define MICROPY_PY_ZLIBD (1) #define MICROPY_PY_UZLIB (1)
#define MICROPY_PY_UJSON (1) #define MICROPY_PY_UJSON (1)
#define MICROPY_PY_URE (1) #define MICROPY_PY_URE (1)
@ -77,6 +77,7 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
extern const struct _mp_obj_module_t pyb_module; extern const struct _mp_obj_module_t pyb_module;
extern const struct _mp_obj_module_t stm_module; extern const struct _mp_obj_module_t stm_module;
extern const struct _mp_obj_module_t mp_module_ure; extern const struct _mp_obj_module_t mp_module_ure;
extern const struct _mp_obj_module_t mp_module_uzlib;
extern const struct _mp_obj_module_t mp_module_ujson; extern const struct _mp_obj_module_t mp_module_ujson;
extern const struct _mp_obj_module_t mp_module_uos; extern const struct _mp_obj_module_t mp_module_uos;
extern const struct _mp_obj_module_t mp_module_utime; extern const struct _mp_obj_module_t mp_module_utime;
@ -95,6 +96,7 @@ extern const struct _mp_obj_module_t mp_module_network;
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \ #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
{ MP_OBJ_NEW_QSTR(MP_QSTR_re), (mp_obj_t)&mp_module_ure }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_re), (mp_obj_t)&mp_module_ure }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_zlib), (mp_obj_t)&mp_module_uzlib }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_json), (mp_obj_t)&mp_module_ujson }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_json), (mp_obj_t)&mp_module_ujson }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&mp_module_uos }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&mp_module_uos }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&mp_module_utime }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&mp_module_utime }, \

View File

@ -73,6 +73,7 @@ Q(elapsed_micros)
// for module weak links // for module weak links
Q(re) Q(re)
Q(zlib)
Q(json) Q(json)
// for file class // for file class