Skip to content
  • Stefan Beller's avatar
    replace-object: eliminate replace objects prepared flag · c1274495
    Stefan Beller authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Make the oidmap a pointer.
    
    That way we eliminate the need for the global boolean
    variable 'replace_object_prepared' as we can put this information
    into the pointer being NULL or not.
    
    Another advantage of this is that we would more quickly catch
    code that tries to access replace-map without initializing it.
    
    This also allows the '#include "oidmap.h"' introduced in a previous
    patch to be replaced by the forward declaration of 'struct oidmap;'.
    Keeping the type opaque discourages circumventing accessor functions;
    not dragging in other headers avoids some compile time overhead.
    
    One disadvantage of this is change is performance as we need to
    pay the overhead for a malloc. The alternative of moving the
    global variable into the object store is less modular code.
    
    Helped-by: default avatarRené Scharfe <l.s.r@web.de>
    Helped-by: default avatarJunio C Hamano <gitster@pobox.com>
    Signed-off-by: default avatarStefan Beller <sbeller@google.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    c1274495