• mackyle's avatar
    mailinfo.c: move side-effects outside of assert · 08414938
    mackyle authored
    Since 6b4b013f (mailinfo: handle in-body header continuations,
    2016-09-20, v2.11.0) mailinfo.c has contained new code with an
    assert of the form:
    
    	assert(call_a_function(...))
    
    The function in question, check_header, has side effects.  This
    means that when NDEBUG is defined during a release build the
    function call is omitted entirely, the side effects do not
    take place and tests (fortunately) start failing.
    
    Since the only time that mi->inbody_header_accum is appended to is
    in check_inbody_header, and appending onto a blank
    mi->inbody_header_accum always happens when is_inbody_header is
    true, this guarantees a prefix that causes check_header to always
    return true.
    
    Therefore replace the assert with an if !check_header + DIE
    combination to reflect this.
    Helped-by: default avatarJonathan Tan <[email protected]>
    Helped-by: default avatarJeff King <[email protected]>
    Acked-by: Johannes Schindelin's avatarJohannes Schindelin <[email protected]>
    Signed-off-by: mackyle's avatarKyle J. McKay <[email protected]>
    Signed-off-by: default avatarJunio C Hamano <[email protected]>
    08414938
mailinfo.c 24.7 KB