summaryrefslogtreecommitdiff
path: root/strbuf.h
Commit message (Collapse)AuthorAgeFilesLines
* strbuf_addch: avoid calling strbuf_growJeff King2015-04-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We mark strbuf_addch as inline, because we expect it may be called from a tight loop. However, the first thing it does is call the non-inline strbuf_grow(), which can handle arbitrary-sized growth. Since we know that we only need a single character, we can use the inline strbuf_avail() to quickly check whether we need to grow at all. Our check is redundant when we do call strbuf_grow(), but that's OK. The common case is that we avoid calling it at all, and we have made that case faster. On a silly pathological case: perl -le ' print "[core]"; print "key$_ = value$_" for (1..1000000) ' >input git config -f input core.key1 this dropped the time to run git-config from: real 0m0.159s user 0m0.152s sys 0m0.004s to: real 0m0.140s user 0m0.136s sys 0m0.004s for a savings of 12%. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf.h: group documentation for trim functionsjk/strbuf-doc-to-headerJeff King2015-01-161-10/+2
| | | | | | | | | The relationship between these makes more sense if you read them as a group, which can help people who are looking for the right function. Let's give them a single comment. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf.h: drop boilerplate descriptions of strbuf_split_*Jeff King2015-01-161-12/+5
| | | | | | | | | | | | | | | | | | | | | | The description of strbuf_split_buf says most of what needs to be said for all of the split variants that take strings, raw memory, etc. We have a boilerplate comment above each that points to the first. This boilerplate ends up making it harder to read, because it spaces out the functions, which could otherwise be read as a group. Let's drop the boilerplate completely, and mention the variants in the top comment. This is perhaps slightly worse for a hypothetical system which pulls the documentation for each function out of the comment immediately preceding it. But such a system does not yet exist, and anyway, the end result of extracting the boilerplate comments would not lead to a very easy-to-read result. We would do better in the long run to teach the extraction system about groups of related functions. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf.h: reorganize api function grouping headersJeff King2015-01-161-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original API doc had something like: Functions --------- * Life cycle ... some life-cycle functions ... * Related to the contents of the buffer ... functions related to contents .... etc This grouping can be hard to read in the comment sources, given the "*" in the comment lines, and the amount of text between each section. Instead, let's make a flat list of groupings, and underline each as a section header. That makes them stand out, and eliminates the weird half-phrase of "Related to...". Like: Functions related to the contents of the buffer ----------------------------------------------- Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf.h: format asciidoc code blocks as 4-space indentJeff King2015-01-161-7/+4
| | | | | | | | | This is much easier to read when the whole thing is stuffed inside a comment block. And there is precedent for this convention in markdown (and just in general ascii text). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf.h: drop asciidoc list formatting from API docsJeff King2015-01-161-37/+37
| | | | | | | | | | Using a hanging indent is much more readable. This means we won't format as asciidoc anymore, but since we don't have a working system for extracting these comments anyway, it's probably more important to just make the source readable. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf.h: unify documentation comments beginningsStefan Beller2015-01-161-7/+7
| | | | | | | | | | | The prior patch uses "/**" to denote "documentation" comments that we pulled from api-strbuf.txt. Let's use a consistent style for similar comments that were already in strbuf.h. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf.h: integrate api-strbuf.txt documentationJeff King2015-01-161-67/+390
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of strbuf is documented as comments above functions, and some is separate in Documentation/technical/api-strbuf.txt. This makes it annoying to find the appropriate documentation. We'd rather have it all in one place, which means all in the text document, or all in the header. Let's choose the header as that place. Even though the formatting is not quite as pretty, this keeps the documentation close to the related code. The hope is that this makes it easier to find what you want (human-readable comments are right next to the C declarations), and easier for writers to keep the documentation up to date. This is more or less a straight import of the text from api-strbuf.txt into C comments, complete with asciidoc formatting. The exceptions are: 1. All comments created in this way are started with "/**" to indicate they are part of the API documentation. This may help later with extracting the text to pretty-print it. 2. Function descriptions do not repeat the function name, as it is available in the context directly below. So: `strbuf_add`:: Add data of given length to the buffer. from api-strbuf.txt becomes: /** * Add data of given length to the buffer. */ void strbuf_add(struct strbuf *sb, const void *, size_t); As a result, any block-continuation required in asciidoc for that list item was dropped in favor of straight blank-line paragraph (since it is not necessary when we are not in a list item). 3. There is minor re-wording to integrate existing comments and api-strbuf text. In each case, I took whichever version was more descriptive, and eliminated any redundancies. In one case, for strbuf_addstr, the api documentation gave its inline definition; I eliminated this as redundant with the actual definition, which can be seen directly below the comment. 4. The functions in the header file are re-ordered to match the ordering of the API documentation, under the assumption that more thought went into the grouping there. Helped-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'rs/export-strbuf-addchars'Junio C Hamano2014-09-191-0/+1
|\ | | | | | | | | | | | | | | Code clean-up. * rs/export-strbuf-addchars: strbuf: use strbuf_addchars() for adding a char multiple times strbuf: export strbuf_addchars()
| * strbuf: export strbuf_addchars()René Scharfe2014-09-081-0/+1
| | | | | | | | | | | | | | | | Move strbuf_addchars() to strbuf.c, where it belongs, and make it available for other callers. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'rs/strbuf-getcwd'Junio C Hamano2014-09-021-0/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce the use of fixed sized buffer passed to getcwd() calls by introducing xgetcwd() helper. * rs/strbuf-getcwd: use strbuf_add_absolute_path() to add absolute paths abspath: convert absolute_path() to strbuf use xgetcwd() to set $GIT_DIR use xgetcwd() to get the current directory or die wrapper: add xgetcwd() abspath: convert real_path_internal() to strbuf abspath: use strbuf_getcwd() to remember original working directory setup: convert setup_git_directory_gently_1 et al. to strbuf unix-sockets: use strbuf_getcwd() strbuf: add strbuf_getcwd()
| * | abspath: convert absolute_path() to strbufRené Scharfe2014-08-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move most of the code of absolute_path() into the new function strbuf_add_absolute_path() and in the process transform it to use struct strbuf and xgetcwd() instead of a PATH_MAX-sized buffer, which can be too small on some file systems. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | strbuf: add strbuf_getcwd()René Scharfe2014-07-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add strbuf_getcwd(), which puts the current working directory into a strbuf. Because it doesn't use a fixed-size buffer it supports arbitrarily long paths, provided the platform's getcwd() does as well. At least on Linux and FreeBSD it handles paths longer than PATH_MAX just fine. Suggested-by: Karsten Blees <karsten.blees@gmail.com> Helped-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jk/strip-suffix'Junio C Hamano2014-07-161-0/+9
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jk/strip-suffix: prepare_packed_git_one: refactor duplicate-pack check verify-pack: use strbuf_strip_suffix strbuf: implement strbuf_strip_suffix index-pack: use strip_suffix to avoid magic numbers use strip_suffix instead of ends_with in simple cases replace has_extension with ends_with implement ends_with via strip_suffix add strip_suffix function sha1_file: replace PATH_MAX buffer with strbuf in prepare_packed_git_one()
| * | | strbuf: implement strbuf_strip_suffixJeff King2014-06-301-0/+9
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | You can almost get away with just calling "strip_suffix_mem" on a strbuf's buf and len fields. But we also need to move the NUL-terminator to satisfy strbuf's invariants. Let's provide a convenience wrapper that handles this. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | strbuf: add xstrfmt helperJeff King2014-06-191-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can use a strbuf to build up a string from parts, and then detach it. In the general case, you might use multiple strbuf_add* functions to do the building. However, in many cases, a single strbuf_addf is sufficient, and we end up with: struct strbuf buf = STRBUF_INIT; ... strbuf_addf(&buf, fmt, some, args); str = strbuf_detach(&buf, NULL); We can make this much more readable (and avoid introducing an extra variable, which can clutter the code) by introducing a convenience function: str = xstrfmt(fmt, some, args); Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jk/http-errors'Junio C Hamano2014-06-161-0/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagate the error messages from the webserver better to the client coming over the HTTP transport. * jk/http-errors: http: default text charset to iso-8859-1 remote-curl: reencode http error messages strbuf: add strbuf_reencode helper http: optionally extract charset parameter from content-type http: extract type/subtype portion of content-type t5550: test display of remote http error messages t/lib-httpd: use write_script to copy CGI scripts test-lib: preserve GIT_CURL_VERBOSE from the environment
| * | | strbuf: add strbuf_reencode helperJeff King2014-05-271-0/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | This is a convenience wrapper around `reencode_string_len` and `strbuf_attach`. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jk/strbuf-tolower'Junio C Hamano2014-06-161-0/+1
|\ \ \ | | | | | | | | | | | | | | | | * jk/strbuf-tolower: strbuf: add strbuf_tolower function
| * | | strbuf: add strbuf_tolower functionjk/strbuf-tolowerJeff King2014-05-231-0/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a convenience wrapper to call tolower on each character of the string. This makes config's lowercase() function obsolete, though note that because we have a strbuf, we are careful to operate over the whole strbuf, rather than assuming that a NUL is the end-of-string. We could continue to offer a pure-string lowercase, but there would be no callers (in most pure-string cases, we actually duplicate and lowercase the duplicate, for which we have the xstrdup_tolower wrapper). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jk/daemon-tolower'Junio C Hamano2014-06-161-0/+2
|\ \ \ | |/ / |/| | | | | | | | * jk/daemon-tolower: daemon/config: factor out duplicate xstrdup_tolower
| * | daemon/config: factor out duplicate xstrdup_tolowerjk/daemon-tolowerJeff King2014-05-231-0/+2
| |/ | | | | | | | | | | | | | | | | | | We have two implementations of the same function; let's drop that to one. We take the name from daemon.c, but the implementation (which is just slightly more efficient) from the config code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | strbuf: style fix -- top opening bracket on a separate linend/strbuf-inline-stylesNguyễn Thái Ngọc Duy2014-03-031-6/+12
|/ | | | | Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf: create strbuf_humanise_bytes() to show byte sizesAntoine Pelisse2013-04-101-0/+1
| | | | | | | | | | | | | | | | | Humanization of downloaded size is done in the same function as text formatting in 'process.c'. The code cannot be reused easily elsewhere. Separate text formatting from size simplification and make the function public in strbuf so that it can easily be used by other callers. We now can use strbuf_humanise_bytes() for both downloaded size and download speed calculation. One of the drawbacks is that speed will now look like this when download is stalled: "0 bytes/s" instead of "0 KiB/s". Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Allow custom "comment char"Junio C Hamano2013-01-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some users do want to write a line that begin with a pound sign, #, in their commit log message. Many tracking system recognise a token of #<bugid> form, for example. The support we offer these use cases is not very friendly to the end users. They have a choice between - Don't do it. Avoid such a line by rewrapping or indenting; and - Use --cleanup=whitespace but remove all the hint lines we add. Give them a way to set a custom comment char, e.g. $ git -c core.commentchar="%" commit so that they do not have to do either of the two workarounds. [jc: although I started the topic, all the tests and documentation updates, many of the call sites of the new strbuf_add_commented_*() functions, and the change to git-submodule.sh scripted Porcelain are from Ralf.] Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'mh/unify-xml-in-imap-send-and-http-push'Junio C Hamano2013-01-051-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update imap-send to reuse xml quoting code from http-push codepath, clean up some code, and fix a small bug. * mh/unify-xml-in-imap-send-and-http-push: wrap_in_html(): process message in bulk rather than line-by-line wrap_in_html(): use strbuf_addstr_xml_quoted() imap-send: change msg_data from storing (ptr, len) to storing strbuf imap-send: correctly report errors reading from stdin imap-send: store all_msgs as a strbuf lf_to_crlf(): NUL-terminate msg_data::data xml_entities(): use function strbuf_addstr_xml_quoted() Add new function strbuf_add_xml_quoted()
| * Add new function strbuf_add_xml_quoted()Michael Haggerty2012-11-261-0/+6
| | | | | | | | | | | | | | | | Substantially the same code is present in http-push.c and imap-send.c, so make a library function out of it. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | strbuf_split*(): document functionsMichael Haggerty2012-11-041-0/+33
| | | | | | | | | | | | | | | | | | | | Document strbuf_split_buf(), strbuf_split_str(), strbuf_split_max(), strbuf_split(), and strbuf_list_free() in the header file and in api-strbuf.txt. (These functions were previously completely undocumented.) Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net>
* | strbuf_split*(): rename "delim" parameter to "terminator"Michael Haggerty2012-11-041-7/+8
|/ | | | | | | | | | | | The word "delimiter" suggests that the argument separates the substrings, whereas in fact (1) the delimiter characters are included in the output, and (2) if the input string ends with the delimiter, then the output does not include a final empty string. So rename the "delim" arguments of the strbuf_split() family of functions to "terminator", which is more suggestive of how it is used. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net>
* strbuf.c: mark a private file-scope symbol as staticJunio C Hamano2012-09-151-4/+0
| | | | | | Also remove an unused function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf: convenience format functions with \n automatically appendedNguyễn Thái Ngọc Duy2012-04-241-0/+7
| | | | | | | | | | | | | | These functions are helpful when we do not want to expose \n to translators. For example printf("hello world\n"); can be converted to printf_ln(_("hello world")); Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'tr/maint-bundle-long-subject'Junio C Hamano2012-02-261-0/+1
|\ | | | | | | | | | | | | | | * tr/maint-bundle-long-subject: t5704: match tests to modern style strbuf: improve strbuf_get*line documentation bundle: use a strbuf to scan the log for boundary commits bundle: put strbuf_readline_fd in strbuf.c with adjustments
| * bundle: put strbuf_readline_fd in strbuf.c with adjustmentsThomas Rast2012-02-221-0/+1
| | | | | | | | | | | | | | | | | | The comment even said that it should eventually go there. While at it, match the calling convention and name of the function to the strbuf_get*line family. So it now is strbuf_getwholeline_fd. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jk/credentials'Junio C Hamano2011-12-191-0/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jk/credentials: t: add test harness for external credential helpers credentials: add "store" helper strbuf: add strbuf_add*_urlencode Makefile: unix sockets may not available on some platforms credentials: add "cache" helper docs: end-user documentation for the credential subsystem credential: make relevance of http path configurable credential: add credential.*.username credential: apply helper config http: use credential API to get passwords credential: add function for parsing url components introduce credentials API t5550: fix typo test-lib: add test_config_global variant Conflicts: strbuf.c
| * | strbuf: add strbuf_add*_urlencodeJeff King2011-12-121-0/+5
| |/ | | | | | | | | | | | | | | This just follows the rfc3986 rules for percent-encoding url data into a strbuf. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | fmt-merge-msg: Add contents of merged tag in the merge messageJunio C Hamano2011-11-081-0/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | When a contributor asks the integrator to merge her history, a signed tag can be a good vehicle to communicate the authenticity of the request while conveying other information such as the purpose of the topic. E.g. a signed tag "for-linus" can be created, and the integrator can run: $ git pull git://example.com/work.git/ for-linus This would allow the integrator to run "git verify-tag FETCH_HEAD" to validate the signed tag. Update fmt-merge-msg so that it pre-fills the merge message template with the body (but not signature) of the tag object to help the integrator write a better merge message, in the same spirit as the existing merge.log summary lines. The message that comes from GPG signature validation is also included in the merge message template to help the integrator verify it, but they are prefixed with "#" to make them comments. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jk/maint-config-param'Junio C Hamano2011-07-191-1/+16
|\ | | | | | | | | | | | | | | | | | | * jk/maint-config-param: config: use strbuf_split_str instead of a temporary strbuf strbuf: allow strbuf_split to work on non-strbufs config: avoid segfault when parsing command-line config config: die on error in command-line config fix "git -c" parsing of values with equals signs strbuf_split: add a max parameter
| * strbuf: allow strbuf_split to work on non-strbufsJeff King2011-06-221-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | The strbuf_split function takes a strbuf as input, and outputs a list of strbufs. However, there is no reason that the input has to be a strbuf, and not an arbitrary buffer. This patch adds strbuf_split_buf for a length-delimited buffer, and strbuf_split_str for NUL-terminated strings. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * strbuf_split: add a max parameterJeff King2011-06-221-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes when splitting, you only want a limited number of fields, and for the final field to contain "everything else", even if it includes the delimiter. This patch introduces strbuf_split_max, which provides a "max number of fields" parameter; it behaves similarly to perl's "split" with a 3rd field. The existing 2-argument form of strbuf_split is retained for compatibility and ease-of-use. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | strbuf: clarify assertion in strbuf_setlen()René Scharfe2011-04-271-5/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | Commit a8f3e2219 introduced the strbuf_grow() call to strbuf_setlen() to make ensure that there was at least one byte available to write the mandatory trailing NUL, even for previously unallocated strbufs. Then b315c5c0 added strbuf_slopbuf for the same reason, only globally for all uses of strbufs. Thus the strbuf_grow() call can be removed now. This avoids readers of strbuf.h from mistakenly thinking that strbuf_setlen() can be used to extend a strbuf. The following assert() needs to be changed to cope with the fact that sb->alloc can now be zero, which is OK as long as len is also zero. As suggested by Junio, use the chance to convert it to a die() with a short explanatory message. The pattern of 'die("BUG: ...")' is already used in strbuf.c. This was the only assert() in strbuf.[ch], so assert.h doesn't have to be included anymore either. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint'Junio C Hamano2011-03-301-36/+1
|\ | | | | | | | | | | | | | | | | | | | | * maint: contrib/thunderbird-patch-inline: do not require bash to run the script t8001: check the exit status of the command being tested strbuf.h: remove a tad stale docs-in-comment and reference api-doc instead Typos: t/README Documentation/config.txt: make truth value of numbers more explicit git-pack-objects.txt: fix grammatical errors parse-remote: replace unnecessary sed invocation
| * strbuf.h: remove a tad stale docs-in-comment and reference api-doc insteadMichael Witten2011-03-301-36/+1
| | | | | | | | | | Signed-off-by: Michael Witten <mfwitten@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | strbuf: add strbuf_vaddfJeff King2011-02-261-0/+2
|/ | | | | | | | | | | | | | | | In a variable-args function, the code for writing into a strbuf is non-trivial. We ended up cutting and pasting it in several places because there was no vprintf-style function for strbufs (which in turn was held up by a lack of va_copy). Now that we have a fallback va_copy, we can add strbuf_vaddf, the strbuf equivalent of vsprintf. And we can clean up the cut and paste mess. Signed-off-by: Jeff King <peff@peff.net> Improved-by: Christian Couder <christian.couder@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf.h: fix comment typoPat Notz2010-09-271-1/+1
| | | | | Signed-off-by: Pat Notz <patnotz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jc/maint-strbuf-add-fix-doubling'Junio C Hamano2010-01-201-0/+1
|\ | | | | | | | | * jc/maint-strbuf-add-fix-doubling: strbuf_addbuf(): allow passing the same buf to dst and src
| * strbuf_addbuf(): allow passing the same buf to dst and srcJunio C Hamano2010-01-131-0/+1
| | | | | | | | | | | | | | | | | | If sb and sb2 are the same (i.e. doubling the string), the underlying strbuf_add() can make sb2->buf invalid by calling strbuf_grow(sb) at the beginning; if realloc(3) done by strbuf_grow() needs to move the string, strbuf_add() will read from an already freed buffer. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jk/warn-author-committer-after-commit'Junio C Hamano2010-01-201-0/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jk/warn-author-committer-after-commit: user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere commit.c::print_summary: do not release the format string too early commit: allow suppression of implicit identity advice commit: show interesting ident information in summary strbuf: add strbuf_addbuf_percentquote strbuf_expand: convert "%%" to "%" Conflicts: builtin-commit.c ident.c
| * | strbuf: add strbuf_addbuf_percentquoteJeff King2010-01-141-0/+1
| |/ | | | | | | | | | | | | | | This is handy for creating strings which will be fed to printf() or strbuf_expand(). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | strbuf.c: remove unused functionJunio C Hamano2010-01-121-1/+0
|/ | | | | | strbuf_tolower() is not used anywhere. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Check the format of more printf-type functionsTarmigan Casebolt2009-11-151-1/+1
| | | | | | | | | | | We already have these checks in many printf-type functions that have prototypes which are in header files. Add these same checks to some more prototypes in header functions and to static functions in .c files. cc: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>