Commit cfdc88f
hex_to_bytes(): simpler replacement for
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: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>get_oid_hex_segment()
1 parent d49852d commit cfdc88f
1 file changed
Lines changed: 10 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
344 | 341 | | |
345 | | - | |
346 | | - | |
| 342 | + | |
347 | 343 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 344 | + | |
352 | 345 | | |
| 346 | + | |
353 | 347 | | |
354 | 348 | | |
355 | | - | |
356 | | - | |
| 349 | + | |
357 | 350 | | |
358 | 351 | | |
359 | 352 | | |
| |||
438 | 431 | | |
439 | 432 | | |
440 | 433 | | |
441 | | - | |
442 | | - | |
| 434 | + | |
| 435 | + | |
443 | 436 | | |
444 | 437 | | |
445 | 438 | | |
| |||
451 | 444 | | |
452 | 445 | | |
453 | 446 | | |
454 | | - | |
455 | | - | |
| 447 | + | |
456 | 448 | | |
457 | 449 | | |
458 | 450 | | |
| |||
0 commit comments