Skip to content

Commit 4b71c05

Browse files
committed
moduzlib: Fix fn prototype and some code style; use it in stmhal port.
1 parent 29f5682 commit 4b71c05

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

extmod/moduzlib.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
#define DEBUG_printf(...) (void)0
4949
#endif
5050

51-
STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req)
52-
{
51+
STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req) {
5352
if (alloc_req < 256) {
5453
alloc_req = 256;
5554
}
@@ -59,7 +58,7 @@ STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req)
5958
return 0;
6059
}
6160

62-
STATIC mp_obj_t mod_uzlib_decompress(uint n_args, mp_obj_t *args) {
61+
STATIC mp_obj_t mod_uzlib_decompress(mp_uint_t n_args, const mp_obj_t *args) {
6362
mp_obj_t data = args[0];
6463
mp_buffer_info_t bufinfo;
6564
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
@@ -112,4 +111,4 @@ const mp_obj_module_t mp_module_uzlib = {
112111
#include "uzlib/tinfzlib.c"
113112
#include "uzlib/adler32.c"
114113

115-
#endif //MICROPY_PY_UZLIB
114+
#endif // MICROPY_PY_UZLIB

stmhal/mpconfigport.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#define MICROPY_PY_IO (1)
5858
#define MICROPY_PY_IO_FILEIO (1)
5959
#define MICROPY_PY_UCTYPES (1)
60-
#define MICROPY_PY_ZLIBD (1)
60+
#define MICROPY_PY_UZLIB (1)
6161
#define MICROPY_PY_UJSON (1)
6262
#define MICROPY_PY_URE (1)
6363

@@ -77,6 +77,7 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
7777
extern const struct _mp_obj_module_t pyb_module;
7878
extern const struct _mp_obj_module_t stm_module;
7979
extern const struct _mp_obj_module_t mp_module_ure;
80+
extern const struct _mp_obj_module_t mp_module_uzlib;
8081
extern const struct _mp_obj_module_t mp_module_ujson;
8182
extern const struct _mp_obj_module_t mp_module_uos;
8283
extern const struct _mp_obj_module_t mp_module_utime;
@@ -95,6 +96,7 @@ extern const struct _mp_obj_module_t mp_module_network;
9596

9697
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
9798
{ MP_OBJ_NEW_QSTR(MP_QSTR_re), (mp_obj_t)&mp_module_ure }, \
99+
{ MP_OBJ_NEW_QSTR(MP_QSTR_zlib), (mp_obj_t)&mp_module_uzlib }, \
98100
{ MP_OBJ_NEW_QSTR(MP_QSTR_json), (mp_obj_t)&mp_module_ujson }, \
99101
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&mp_module_uos }, \
100102
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&mp_module_utime }, \

stmhal/qstrdefsport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Q(elapsed_micros)
7373

7474
// for module weak links
7575
Q(re)
76+
Q(zlib)
7677
Q(json)
7778

7879
// for file class

0 commit comments

Comments
 (0)