<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/git.git/mailmap.c, branch sk/gitweb-highlight-encoding</title>
<subtitle>github.com: git/git.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/'/>
<entry>
<title>mailmap: use higher level string list functions</title>
<updated>2014-12-04T23:10:21+00:00</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2014-11-25T03:44:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=63226218ba39e971c8a75d9419a7668b075ad85e'/>
<id>63226218ba39e971c8a75d9419a7668b075ad85e</id>
<content type='text'>
No functional changes intended. This commit makes use of higher level
and better documented functions of the string list API, so the code is
more understandable.

Note that also the required computational amount should not change
in principal as we need to look up the item no matter if it is already
part of the list or not. Once looked up, insertion comes for free.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional changes intended. This commit makes use of higher level
and better documented functions of the string list API, so the code is
more understandable.

Note that also the required computational amount should not change
in principal as we need to look up the item no matter if it is already
part of the list or not. Once looked up, insertion comes for free.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'jc/strcasecmp-pure-inline'</title>
<updated>2013-09-25T06:28:13+00:00</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2013-09-25T06:28:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=a301889980237b4d1cba9d07e48bdaf67064af83'/>
<id>a301889980237b4d1cba9d07e48bdaf67064af83</id>
<content type='text'>
* jc/strcasecmp-pure-inline:
  mailmap: work around implementations with pure inline strcasecmp
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* jc/strcasecmp-pure-inline:
  mailmap: work around implementations with pure inline strcasecmp
</pre>
</div>
</content>
</entry>
<entry>
<title>mailmap: work around implementations with pure inline strcasecmp</title>
<updated>2013-09-12T19:05:48+00:00</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-09-12T15:37:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=de2f95ebed260b5fb31942d6315994829fb6fc63'/>
<id>de2f95ebed260b5fb31942d6315994829fb6fc63</id>
<content type='text'>
On some systems (e.g. MinGW 4.0), string.h has only inline
definition of strcasecmp and no non-inline implementation is
supplied anywhere, which is, eh, "unusual".  We cannot take an
address of such a function to store it in namemap.cmp.

Work it around by introducing our own level of indirection.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On some systems (e.g. MinGW 4.0), string.h has only inline
definition of strcasecmp and no non-inline implementation is
supplied anywhere, which is, eh, "unusual".  We cannot take an
address of such a function to store it in namemap.cmp.

Work it around by introducing our own level of indirection.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'sb/mailmap-freeing-NULL-is-ok'</title>
<updated>2013-09-11T22:00:43+00:00</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-09-11T22:00:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=e5229b6a61fefcacd63d11afd49f0cdafaa60801'/>
<id>e5229b6a61fefcacd63d11afd49f0cdafaa60801</id>
<content type='text'>
* sb/mailmap-freeing-NULL-is-ok:
  mailmap: remove redundant check for freeing memory
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* sb/mailmap-freeing-NULL-is-ok:
  mailmap: remove redundant check for freeing memory
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'jk/mailmap-incomplete-line'</title>
<updated>2013-09-09T21:50:41+00:00</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-09-09T21:50:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=af226bf01e99043f5f3d8bc09ad302d17e0de757'/>
<id>af226bf01e99043f5f3d8bc09ad302d17e0de757</id>
<content type='text'>
* jk/mailmap-incomplete-line:
  mailmap: handle mailmap blobs without trailing newlines
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* jk/mailmap-incomplete-line:
  mailmap: handle mailmap blobs without trailing newlines
</pre>
</div>
</content>
</entry>
<entry>
<title>mailmap: handle mailmap blobs without trailing newlines</title>
<updated>2013-08-28T19:33:32+00:00</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-08-28T01:41:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=f972a1658a30809db113a3c486b1fe95b56633bf'/>
<id>f972a1658a30809db113a3c486b1fe95b56633bf</id>
<content type='text'>
The read_mailmap_buf function reads each line of the mailmap
using strchrnul, like:

    const char *end = strchrnul(buf, '\n');
    unsigned long linelen = end - buf + 1;

But that's off-by-one when we actually hit the NUL byte; our
line does not have a terminator, and so is only "end - buf"
bytes long. As a result, when we subtract the linelen from
the total len, we end up with (unsigned long)-1 bytes left
in the buffer, and we start reading random junk from memory.

We could fix it with:

    unsigned long linelen = end - buf + !!*end;

but let's take a step back for a moment. It's questionable
in the first place for a function that takes a buffer and
length to be using strchrnul. But it works because we only
have one caller (and are only likely to ever have this one),
which is handing us data from read_sha1_file. Which means
that it's always NUL-terminated.

Instead of tightening the assumptions to make the
buffer/length pair work for a caller that doesn't actually
exist, let's let loosen the assumptions to what the real
caller has: a modifiable, NUL-terminated string.

This makes the code simpler and shorter (because we don't
have to correlate strchrnul with the length calculation),
correct (because the code with the off-by-one just goes
away), and more efficient (we can drop the extra allocation
we needed to create NUL-terminated strings for each line,
and just terminate in place).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The read_mailmap_buf function reads each line of the mailmap
using strchrnul, like:

    const char *end = strchrnul(buf, '\n');
    unsigned long linelen = end - buf + 1;

But that's off-by-one when we actually hit the NUL byte; our
line does not have a terminator, and so is only "end - buf"
bytes long. As a result, when we subtract the linelen from
the total len, we end up with (unsigned long)-1 bytes left
in the buffer, and we start reading random junk from memory.

We could fix it with:

    unsigned long linelen = end - buf + !!*end;

but let's take a step back for a moment. It's questionable
in the first place for a function that takes a buffer and
length to be using strchrnul. But it works because we only
have one caller (and are only likely to ever have this one),
which is handing us data from read_sha1_file. Which means
that it's always NUL-terminated.

Instead of tightening the assumptions to make the
buffer/length pair work for a caller that doesn't actually
exist, let's let loosen the assumptions to what the real
caller has: a modifiable, NUL-terminated string.

This makes the code simpler and shorter (because we don't
have to correlate strchrnul with the length calculation),
correct (because the code with the off-by-one just goes
away), and more efficient (we can drop the extra allocation
we needed to create NUL-terminated strings for each line,
and just terminate in place).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mailmap: remove redundant check for freeing memory</title>
<updated>2013-08-20T17:10:37+00:00</updated>
<author>
<name>Stefan Beller</name>
<email>stefanbeller@googlemail.com</email>
</author>
<published>2013-08-20T14:18:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=c9ba31f592ccf23dc2aa78a705a790341ea72cfd'/>
<id>c9ba31f592ccf23dc2aa78a705a790341ea72cfd</id>
<content type='text'>
The condition as it is written in that line has already been checked
in the beginning of the function, which was introduced in
8503ee4 (2007-05-01, Fix read_mailmap to handle a caller uninterested
in repo abbreviation)

Helped-by: Jeff King &lt;peff@peff.net&gt;
Helped-by: Thomas Rast &lt;trast@inf.ethz.ch&gt;
Signed-off-by: Stefan Beller &lt;stefanbeller@googlemail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The condition as it is written in that line has already been checked
in the beginning of the function, which was introduced in
8503ee4 (2007-05-01, Fix read_mailmap to handle a caller uninterested
in repo abbreviation)

Helped-by: Jeff King &lt;peff@peff.net&gt;
Helped-by: Thomas Rast &lt;trast@inf.ethz.ch&gt;
Signed-off-by: Stefan Beller &lt;stefanbeller@googlemail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mailmap: style fixes</title>
<updated>2013-07-15T15:23:39+00:00</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-07-15T06:54:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=bd23794552a9d344ddda9fac20d7ee9b7607f6b1'/>
<id>bd23794552a9d344ddda9fac20d7ee9b7607f6b1</id>
<content type='text'>
Wrap overlong lines and format the multi-line comments to match our
coding style.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Wrap overlong lines and format the multi-line comments to match our
coding style.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mailmap: debug: avoid passing NULL to fprintf() '%s' conversion specification</title>
<updated>2013-07-15T15:20:32+00:00</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2013-07-15T06:54:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=fbfba7ade0dde36d8911973b1dac248b81ce1375'/>
<id>fbfba7ade0dde36d8911973b1dac248b81ce1375</id>
<content type='text'>
POSIX does not state the behavior of '%s' conversion when passed a
NULL pointer. Some implementations interpolate literal "(null)";
others may crash.

Callers of debug_mm() often pass NULL as indication of either a
missing name or email address.  Instead, let's always supply a
proper string pointer, and make it a bit more descriptive: "(none)"

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
POSIX does not state the behavior of '%s' conversion when passed a
NULL pointer. Some implementations interpolate literal "(null)";
others may crash.

Callers of debug_mm() often pass NULL as indication of either a
missing name or email address.  Instead, let's always supply a
proper string pointer, and make it a bit more descriptive: "(none)"

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mailmap: debug: eliminate -Wformat field precision type warning</title>
<updated>2013-07-15T15:20:11+00:00</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2013-07-15T06:54:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=a8002a5f0ee19e2a513483e763b8b4a7cdcaa48d'/>
<id>a8002a5f0ee19e2a513483e763b8b4a7cdcaa48d</id>
<content type='text'>
The compiler complains that '*' in fprintf() format "%.*s" should
have type int, but we pass size_t. Fix this.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The compiler complains that '*' in fprintf() format "%.*s" should
have type int, but we pass size_t. Fix this.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
