<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/hex.c, branch v2.18.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.18.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.18.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-11-01T01:35:35Z</updated>
<entry>
<title>notes: move hex_to_bytes() to hex.c and export it</title>
<updated>2017-11-01T01:35:35Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-10-31T13:46:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0ec218656a02ea48e173262f7b80513feeb7f263'/>
<id>urn:sha1:0ec218656a02ea48e173262f7b80513feeb7f263</id>
<content type='text'>
Make the function for converting pairs of hexadecimal digits to binary
available to other call sites.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ</title>
<updated>2017-03-27T05:08:21Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-03-26T16:01:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dc01505f7f272a44b974e622f75bd592debe9dcb'/>
<id>urn:sha1:dc01505f7f272a44b974e622f75bd592debe9dcb</id>
<content type='text'>
Since we will likely be introducing a new hash function at some point,
and that hash function might be longer than 40 hex characters, use the
constant GIT_MAX_HEXSZ, which is designed to be suitable for
allocations, instead of GIT_SHA1_HEXSZ.  This will ease the transition
down the line by distinguishing between places where we need to allocate
memory suitable for the largest hash from those where we need to handle
the current hash.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hex: introduce parse_oid_hex</title>
<updated>2017-02-20T09:11:26Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-02-20T00:10:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=605f430efb23ce14ca11750368149acd38b8f1e4'/>
<id>urn:sha1:605f430efb23ce14ca11750368149acd38b8f1e4</id>
<content type='text'>
Introduce a function, parse_oid_hex, which parses a hexadecimal object
ID and if successful, sets a pointer to just beyond the last character.
This allows for simpler, more robust parsing without needing to
hard-code integer values throughout the codebase.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hex: make wraparound of the index into ring-buffer explicit</title>
<updated>2016-10-26T17:54:11Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-10-23T17:57:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bb84735c80dbae6408b79b56f574ae672d2232d4'/>
<id>urn:sha1:bb84735c80dbae6408b79b56f574ae672d2232d4</id>
<content type='text'>
Overflow is defined for unsigned integers, but not for signed ones.

We could make the ring-buffer index in sha1_to_hex() and
get_pathname() unsigned to be on the safe side to resolve this, but
let's make it explicit that we are wrapping around at whatever the
number of elements the ring-buffer has.  The compiler is smart enough
to turn modulus into bitmask for these codepaths that use
ring-buffers of a size that is a power of 2.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/hex2chr' into maint</title>
<updated>2016-09-19T20:51:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-09-19T20:51:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c3befaeab9ebd0def9f03d434a52cf40614c65f9'/>
<id>urn:sha1:c3befaeab9ebd0def9f03d434a52cf40614c65f9</id>
<content type='text'>
Code cleanup.

* rs/hex2chr:
  introduce hex2chr() for converting two hexadecimal digits to a character
</content>
</entry>
<entry>
<title>introduce hex2chr() for converting two hexadecimal digits to a character</title>
<updated>2016-09-07T17:42:46Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-09-03T15:59:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d23309733a5b2a9e1adc304ee50c5a5ed7a087c2'/>
<id>urn:sha1:d23309733a5b2a9e1adc304ee50c5a5ed7a087c2</id>
<content type='text'>
Add and use a helper function that decodes the char value of two
hexadecimal digits.  It returns a negative number on error, avoids
running over the end of the given string and doesn't shift negative
values.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hex: add oid_to_hex_r()</title>
<updated>2016-06-28T18:39:02Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2016-06-24T23:09:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=55c529a7005c653ceb318e1e25b40ff96a41877f'/>
<id>urn:sha1:55c529a7005c653ceb318e1e25b40ff96a41877f</id>
<content type='text'>
This function works just like sha1_to_hex_r, except that it takes a
pointer to struct object_id instead of a pointer to unsigned char.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add reentrant variants of sha1_to_hex and find_unique_abbrev</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:05:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=af49c6d0918bf04aad89bd885a4eef5767a33d0e'/>
<id>urn:sha1:af49c6d0918bf04aad89bd885a4eef5767a33d0e</id>
<content type='text'>
The sha1_to_hex and find_unique_abbrev functions always
write into reusable static buffers. There are a few problems
with this:

  - future calls overwrite our result. This is especially
    annoying with find_unique_abbrev, which does not have a
    ring of buffers, so you cannot even printf() a result
    that has two abbreviated sha1s.

  - if you want to put the result into another buffer, we
    often strcpy, which looks suspicious when auditing for
    overflows.

This patch introduces sha1_to_hex_r and find_unique_abbrev_r,
which write into a user-provided buffer. Of course this is
just punting on the overflow-auditing, as the buffer
obviously needs to be GIT_SHA1_HEXSZ + 1 bytes. But it is
much easier to audit, since that is a well-known size.

We retain the non-reentrant forms, which just become thin
wrappers around the reentrant ones. This patch also adds a
strbuf variant of find_unique_abbrev, which will be handy in
later patches.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>define utility functions for object IDs</title>
<updated>2015-03-14T05:43:11Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2015-03-13T23:39:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aa1c6fdf478c023180e5ca5f1658b00a72592dc6'/>
<id>urn:sha1:aa1c6fdf478c023180e5ca5f1658b00a72592dc6</id>
<content type='text'>
There are several utility functions (hashcmp and friends) that are used
for comparing object IDs (SHA-1 values).  Using these functions, which
take pointers to unsigned char, with struct object_id requires tiresome
access to the sha1 member, which bloats code and violates the desired
encapsulation.  Provide wrappers around these functions for struct
object_id for neater, more maintainable code.  Use the new constants to
avoid the hard-coded 20s and 40s throughout the original functions.

These functions simply call the underlying pointer-to-unsigned-char
versions to ensure that any performance improvements will be passed
through to the new functions.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sb/hex-object-name-is-at-most-41-bytes-long' into maint</title>
<updated>2015-03-05T21:12:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-05T21:12:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=552f6994d2650f5940b98ff52679ee63959027f9'/>
<id>urn:sha1:552f6994d2650f5940b98ff52679ee63959027f9</id>
<content type='text'>
Code clean-up.

* sb/hex-object-name-is-at-most-41-bytes-long:
  hex.c: reduce memory footprint of sha1_to_hex static buffers
</content>
</entry>
</feed>
