You could move this SeqAppend to after the tidy-up of tagbuf, w and varname; this would free some memory before allocating more (assuming SeqAppend does some allocation), which is always good (it makes it more likely that SeqAppend's allocations succeed).