<feed xmlns='http://www.w3.org/2005/Atom'>
<title>cgit/ui-shared.c, branch v0.9.2</title>
<subtitle>A hyperfast web frontend for git repositories written in C.</subtitle>
<id>http://git.cetero.st/cgit/atom/ui-shared.c?h=v0.9.2</id>
<link rel='self' href='http://git.cetero.st/cgit/atom/ui-shared.c?h=v0.9.2'/>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/'/>
<updated>2013-05-26T14:30:03Z</updated>
<entry>
<title>readme: use string_list instead of space deliminations</title>
<updated>2013-05-26T14:30:03Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2013-05-26T13:20:02Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=dcbc0438b2543a733858d62170f3110a89edbed6'/>
<id>urn:sha1:dcbc0438b2543a733858d62170f3110a89edbed6</id>
<content type='text'>
Now this is possible in cgitrc -

readme=:README.md
readme=:readme.md
readme=:README.mkd
readme=:readme.mkd
readme=:README.rst
readme=:readme.rst
readme=:README.html
readme=:readme.html
readme=:README.htm
readme=:readme.htm
readme=:README.txt
readme=:readme.txt
readme=:README
readme=:readme
readme=:INSTALL.txt
readme=:install.txt
readme=:INSTALL
readme=:install

Suggested-by: John Keeping &lt;john@keeping.me.uk&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>use struct strbuf instead of static buffers</title>
<updated>2013-04-08T14:12:52Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2013-04-06T09:28:57Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=fb3655df3bf85bd405c5921bbd4b3a54c705c839'/>
<id>urn:sha1:fb3655df3bf85bd405c5921bbd4b3a54c705c839</id>
<content type='text'>
Use "struct strbuf" from Git to remove the limit on file path length.

Notes on scan-tree:
This is slightly involved since I decided to pass the strbuf into
add_repo() and modify if whenever a new file name is required, which
should avoid any extra allocations within that function.  The pattern
there is to append the filename, use it and then reset the buffer to its
original length (retaining a trailing '/').

Notes on ui-snapshot:
Since write_archive modifies the argv array passed to it we
copy the argv_array values into a new array of char* and then free the
original argv_array structure and the new array without worrying about
what the values now look like.

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>Convert cgit_print_error to a variadic function</title>
<updated>2013-04-08T14:11:29Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2013-04-06T10:23:52Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=ed5bd30ebe6921dd22948a3f33a314283f043606'/>
<id>urn:sha1:ed5bd30ebe6921dd22948a3f33a314283f043606</id>
<content type='text'>
This removes many uses of "fmt" which uses a fixed size static pool of
fixed size buffers.  Instead of relying on these, we now pass around
argument lists for as long as possible before using a strbuf to render
content of an arbitrary size.

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>Fix out-of-bounds memory accesses with virtual_root=""</title>
<updated>2013-04-08T13:59:46Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2013-04-01T18:03:34Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=b1f17f168b91d709c0c0e62608de301a36f06da9'/>
<id>urn:sha1:b1f17f168b91d709c0c0e62608de301a36f06da9</id>
<content type='text'>
The CGit configuration variable virtual_root is normalized so that it
does not have a trailing '/' character, but it is allowed to be empty
(the empty string and NULL have different meanings here) and there is
code that is insufficiently cautious when checking if it ends in a '/':

	if (virtual_root[strlen(virtual_root) - 1] != '/')

Clearly this check is redundant, but rather than simply removing it we
get a slight efficiency improvement by switching the normalization so
that the virtual_root variable always ends in '/'.  Do this with a new
"ensure_end" helper.

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>Always #include corresponding .h in .c files</title>
<updated>2013-04-08T13:45:34Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2013-04-06T10:37:59Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=8f208794318f83826e98168b8b430f2d9a68bcce'/>
<id>urn:sha1:8f208794318f83826e98168b8b430f2d9a68bcce</id>
<content type='text'>
While doing this, remove declarations from header files where the
corresponding definition is declared "static" in order to avoid build
errors.

Also re-order existing headers in ui-*.c so that the file-specific
header always comes immediately after "cgit.h", helping with future
consistency.

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>Return const char * in cgit_{httpscheme, hosturl, rooturl}()</title>
<updated>2013-04-08T13:43:17Z</updated>
<author>
<name>Lukas Fleischer</name>
<email>cgit@cryptocrack.de</email>
</author>
<published>2013-04-01T15:11:13Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=996f86e664ab6d00a9304a42374e9c691b78ca6b'/>
<id>urn:sha1:996f86e664ab6d00a9304a42374e9c691b78ca6b</id>
<content type='text'>
The return values of these functions are essentially constant and should
never be modified.

Note that this will introduce a compiler warning when we try to free the
return value of any of these functions. However, given that all of these
currently return statically allocated strings in some cases, they need
to be refactored before this can be done anyway.

Signed-off-by: Lukas Fleischer &lt;cgit@cryptocrack.de&gt;
</content>
</entry>
<entry>
<title>ui-shared: squelch compiler warning.</title>
<updated>2013-03-20T20:08:32Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2013-03-20T19:43:13Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=40e1d9b6177558bf4069c09ca6d8e3a682baa988'/>
<id>urn:sha1:40e1d9b6177558bf4069c09ca6d8e3a682baa988</id>
<content type='text'>
Since tail is initialized to 0, we will never get a warning on the last
if statement, but recent gcc complains anyway. So, we initialize len as
well. Future gcc versions should be able to optimize this out anyway.
</content>
</entry>
<entry>
<title>Merge branch 'wip'</title>
<updated>2013-03-20T19:21:25Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2013-03-20T19:21:25Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=0255821e22678d4c58c809efe17bf2798835d5b9'/>
<id>urn:sha1:0255821e22678d4c58c809efe17bf2798835d5b9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>ui-shared: fix return type of cgit_self_link</title>
<updated>2013-03-20T19:21:17Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2013-03-06T20:51:54Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=6d8a789d61f3a682bc040f1f7f44050b1f723546'/>
<id>urn:sha1:6d8a789d61f3a682bc040f1f7f44050b1f723546</id>
<content type='text'>
cgit_self_link() is a void function but implements each case it handles
by doing "return &lt;another_void_function&gt;" which is not valid C; section
6.8.6.4 of C11 says:

	A return statement with an expression shall not appear in a
	function whose return type is void.

Fix this by removing the return keywords and converting the final code
block into an "else".

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>cgit_print_snapshot_links(): Free prefix variable</title>
<updated>2013-03-05T01:47:54Z</updated>
<author>
<name>Lukas Fleischer</name>
<email>cgit@cryptocrack.de</email>
</author>
<published>2013-03-04T12:25:38Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=59fe348deaa270434f05afc56ca8d13618af9ca9'/>
<id>urn:sha1:59fe348deaa270434f05afc56ca8d13618af9ca9</id>
<content type='text'>
Fixes following memory leak seen with "PATH_INFO=/cgit/commit/":

    ==16894== 12 bytes in 1 blocks are definitely lost in loss record 9 of 92
    ==16894==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==16894==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==16894==    by 0x46CAC8: xstrdup (wrapper.c:35)
    ==16894==    by 0x414E34: cgit_print_snapshot_links (ui-shared.c:926)
    ==16894==    by 0x40CFA1: cgit_print_commit (ui-commit.c:102)
    ==16894==    by 0x407B06: commit_fn (cmd.c:54)
    ==16894==    by 0x405E16: process_request (cgit.c:574)
    ==16894==    by 0x4074C8: cache_process (cache.c:322)
    ==16894==    by 0x406C4F: main (cgit.c:872)

Signed-off-by: Lukas Fleischer &lt;cgit@cryptocrack.de&gt;
</content>
</entry>
</feed>
