• Daniel Gröber (dxld)'s avatar
    rts: retainer: simplify pop() control flow · 48e816f0
    Daniel Gröber (dxld) authored
    Instead of breaking out of the switch-in-while construct using `return` this
    uses `goto out` which makes it possible to share a lot of the out-variable
    assignment code in all the cases.
    
    I also replaced the nasty `while(true)` business by the real loop
    condition: `while(*c == NULL)`. All `break` calls inside the switch aready
    have either a check for NULL or an assignment of `c` to NULL so this should
    not change any behaviour.
    
    Using `goto out` also allowed me to remove another minor wart: In the
    MVAR_*/WEAK cases the popOff() call used to happen before reading the
    stackElement. This looked like a use-after-free hazard to me as the stack
    is allocated in blocks and depletion of a block could mean it getting freed
    and possibly overwritten by zero or garbage, depending on the block
    allocator's behaviour.
    48e816f0
RetainerProfile.c 72.8 KB