Skip to content
  • Michael Haggerty's avatar
    hex_to_bytes(): simpler replacement for `get_oid_hex_segment()` · cfdc88f1
    Michael Haggerty authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Now that `get_oid_hex_segment()` does less, it makes sense to rename
    it and simplify its semantics:
    
    * Instead of a `hex_len` parameter, which was the number of hex
      characters (and had to be even), use a `len` parameter, which is the
      number of resulting bytes. This removes then need for the check that
      `hex_len` is even and to divide it by two to determine the number of
      bytes. For good hygiene, declare the `len` parameter to be `size_t`
      instead of `unsigned int`.
    
    * Change the order of the arguments to the more traditional (dst,
      src, len).
    
    * Rename the function to `hex_to_bytes()`.
    
    * Remove a loop variable: just count `len` down instead.
    
    Signed-off-by: default avatarMichael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    cfdc88f1