Skip to content
  • René Scharfe's avatar
    add SWAP macro · 568edcb9
    René Scharfe authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Add a macro for exchanging the values of variables.  It allows users
    to avoid repetition and takes care of the temporary variable for them.
    It also makes sure that the storage sizes of its two parameters are the
    same.  Its memcpy(1) calls are optimized away by current compilers.
    
    Also add a conservative semantic patch for transforming only swaps of
    variables of the same type.
    
    Signed-off-by: default avatarRene Scharfe <l.s.r@web.de>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    568edcb9