• Jeff King's avatar
    replace trivial malloc + sprintf / strcpy calls with xstrfmt · 75faa45a
    Jeff King authored
    It's a common pattern to do:
    
      foo = xmalloc(strlen(one) + strlen(two) + 1 + 1);
      sprintf(foo, "%s %s", one, two);
    
    (or possibly some variant with strcpy()s or a more
    complicated length computation).  We can switch these to use
    xstrfmt, which is shorter, involves less error-prone manual
    computation, and removes many sprintf and strcpy calls which
    make it harder to audit the code for real buffer overflows.
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    75faa45a
unpack-trees.c 48.3 KB