Skip to content
  • Damien George's avatar
    py/vstr: Remove vstr.had_error flag and inline basic vstr functions. · 5da0d29d
    Damien George authored
    The vstr.had_error flag was a relic from the very early days which assumed
    that the malloc functions (eg m_new, m_renew) returned NULL if they failed
    to allocate.  But that's no longer the case: these functions will raise an
    exception if they fail.
    
    Since it was impossible for had_error to be set, this patch introduces no
    change in behaviour.
    
    An alternative option would be to change the malloc calls to the _maybe
    variants, which return NULL instead of raising, but then a lot of code
    will need to explicitly check if the vstr had an error and raise if it
    did.
    
    The code-size savings for this patch are, in bytes: bare-arm:188,
    minimal:456, unix(NDEBUG,x86-64):368, stmhal:228, esp8266:360.
    5da0d29d