diff options
| author | Damien George <damien.p.george@gmail.com> | 2014-04-25 23:45:52 +0100 | 
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2014-04-25 23:45:52 +0100 | 
| commit | c492cf1f442653019b287bf0e8bd0c43f2abd837 (patch) | |
| tree | 080ca4ed09ce63c6edd3cfc8bf0c6e8298588eb6 /py/gc.c | |
| parent | daab651c5ca0d7198f6db2fa0abe2399fc08c69e (diff) | |
| parent | 755565d2cbc7c7f7abe6f457012b49ddf6b23ca1 (diff) | |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/gc.c')
| -rw-r--r-- | py/gc.c | 13 | 
1 files changed, 8 insertions, 5 deletions
@@ -442,14 +442,17 @@ void *gc_realloc(void *ptr, machine_uint_t n_bytes) {      if (n_bytes <= n_existing) {          return ptr;      } else { -        // TODO false is incorrect! Should get value from current block! -        void *ptr2 = gc_alloc(n_bytes, +        bool has_finaliser; +        if (ptr == NULL) { +            has_finaliser = false; +        } else {  #if MICROPY_ENABLE_FINALISER -                        FTB_GET(BLOCK_FROM_PTR((machine_uint_t)ptr)) +            has_finaliser = FTB_GET(BLOCK_FROM_PTR((machine_uint_t)ptr));  #else -                        false +            has_finaliser = false;  #endif -        ); +        } +        void *ptr2 = gc_alloc(n_bytes, has_finaliser);          if (ptr2 == NULL) {              return ptr2;          }  | 
