<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/strbuf.c, branch v1.6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.6.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2009-03-23T06:52:11Z</updated>
<entry>
<title>strbuf_check_branch_ref(): a helper to check a refname for a branch</title>
<updated>2009-03-23T06:52:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2009-03-21T21:35:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a2fab531bbb00ff64335906e22854365be2eb5c7'/>
<id>urn:sha1:a2fab531bbb00ff64335906e22854365be2eb5c7</id>
<content type='text'>
This allows a common calling sequence

	strbuf_branchname(&amp;ref, name);
	strbuf_splice(&amp;ref, 0, 0, "refs/heads/", 11);
	if (check_ref_format(ref.buf))
		die(...);

to be refactored into

	if (strbuf_check_branch_ref(&amp;ref, name))
		die(...);

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf_branchname(): a wrapper for branch name shorthands</title>
<updated>2009-03-23T06:44:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2009-03-21T20:17:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a552de75eb01f78046feaf7dc88e5e4833624ad5'/>
<id>urn:sha1:a552de75eb01f78046feaf7dc88e5e4833624ad5</id>
<content type='text'>
The function takes a user-supplied string that is supposed to be a branch
name, and puts it in a strbuf after expanding possible shorthand notation.

A handful of open coded sequence to do this in the existing code have been
changed to use this helper function.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Microoptimize strbuf_cmp</title>
<updated>2009-03-20T16:35:32Z</updated>
<author>
<name>Alex Riesen</name>
<email>raa.lkml@gmail.com</email>
</author>
<published>2009-03-19T22:27:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8f0246551c3964eeb16d9c9f39845bd53af8bda8'/>
<id>urn:sha1:8f0246551c3964eeb16d9c9f39845bd53af8bda8</id>
<content type='text'>
It can be less object code and may be even faster, even if at the
moment there is no callers to take an advantage of that. This
implementation can be trivially made inlinable later.

Signed-off-by: Alex Riesen &lt;raa.lkml@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: instate cleanup rule in case of non-memory errors</title>
<updated>2009-01-07T06:13:43Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2009-01-06T20:41:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2fc647004ac7016128372a85db8245581e493812'/>
<id>urn:sha1:2fc647004ac7016128372a85db8245581e493812</id>
<content type='text'>
Make all strbuf functions that can fail free() their memory on error if
they have allocated it.  They don't shrink buffers that have been grown,
though.

This allows for easier error handling, as callers only need to call
strbuf_release() if A) the command succeeded or B) if they would have had
to do so anyway because they added something to the strbuf themselves.

Bonus hunk: document strbuf_readlink.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add generic 'strbuf_readlink()' helper function</title>
<updated>2008-12-17T21:36:30Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2008-12-17T17:36:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b11b7e13f48ee283738e21fea9f775cd40ca0562'/>
<id>urn:sha1:b11b7e13f48ee283738e21fea9f775cd40ca0562</id>
<content type='text'>
It was already what 'git apply' did in read_old_data(), just export it
as a real function, and make it be more generic.

In particular, this handles the case of the lstat() st_size data not
matching the readlink() return value properly (which apparently happens
at least on NTFS under Linux).  But as a result of this you could also
use the new function without even knowing how big the link is going to
be, and it will allocate an appropriately sized buffer.

So we pass in the st_size of the link as just a hint, rather than a
fixed requirement.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add strbuf_expand_dict_cb(), a helper for simple cases</title>
<updated>2008-11-24T03:55:47Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2008-11-22T23:09:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9b864e730bda0e028a85387fa568429724582f22'/>
<id>urn:sha1:9b864e730bda0e028a85387fa568429724582f22</id>
<content type='text'>
The new callback function strbuf_expand_dict_cb() can be used together
with strbuf_expand() if there is only a small number of placeholders
for static replacement texts.  It expects its dictionary as an array of
placeholder+value pairs as context parameter, terminated by an entry
with the placeholder member set to NULL.

The new helper is intended to aid converting the remaining calls of
interpolate().  strbuf_expand() is smaller, more flexible and can be
used to go faster than interpolate(), so it should replace the latter.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add some useful functions for strbuf manipulation.</title>
<updated>2008-07-13T21:04:04Z</updated>
<author>
<name>Lukas Sandström</name>
<email>lukass@etek.chalmers.se</email>
</author>
<published>2008-07-13T18:29:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eacd6dc59411964cc025ba8a9897faa1fb1e6bc6'/>
<id>urn:sha1:eacd6dc59411964cc025ba8a9897faa1fb1e6bc6</id>
<content type='text'>
Signed-off-by: Lukas Sandström &lt;lukass@etek.chalmers.se&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Make some strbuf_*() struct strbuf arguments const.</title>
<updated>2008-07-13T20:59:34Z</updated>
<author>
<name>Lukas Sandström</name>
<email>lukass@etek.chalmers.se</email>
</author>
<published>2008-07-13T18:28:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9b200fd68c799868c5c1383ef3eb34de7027f467'/>
<id>urn:sha1:9b200fd68c799868c5c1383ef3eb34de7027f467</id>
<content type='text'>
Signed-off-by: Lukas Sandström &lt;lukass@etek.chalmers.se&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Avoid a useless prefix lookup in strbuf_expand()</title>
<updated>2008-02-10T07:57:08Z</updated>
<author>
<name>Marco Costalba</name>
<email>mcostalba@gmail.com</email>
</author>
<published>2008-02-09T14:40:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c3a670de50589dedf2d9b83305e8bd0ff63a1a60'/>
<id>urn:sha1:c3a670de50589dedf2d9b83305e8bd0ff63a1a60</id>
<content type='text'>
Currently, the --pretty=format prefix is looked up in a
tight loop in strbuf_expand(), if prefix is found it is then
used as argument for format_commit_item() that does another
search by a switch statement to select the proper operation.

Because the switch statement is already able to discard
unknown matches we don't need the prefix lookup before
to call format_commit_item().

Signed-off-by: Marco Costalba &lt;mcostalba@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Uninline prefixcmp()</title>
<updated>2008-01-03T09:23:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-01-03T09:23:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=698a68be7b0df6dd8d0880e0e2167cad8688a6ad'/>
<id>urn:sha1:698a68be7b0df6dd8d0880e0e2167cad8688a6ad</id>
<content type='text'>
Now the routine is an open-coded loop that avoids an extra
strlen() in the previous implementation, it got a bit too big to
be inlined.  Uninlining it makes code footprint smaller but the
result still retains the avoidance of strlen() cost.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
