summaryrefslogtreecommitdiff
path: root/Documentation/technical/api-argv-array.txt
AgeCommit message (Collapse)Author
2016-02-22argv-array: add detach functionJeff King
The usual pattern for an argv array is to initialize it, push in some strings, and then clear it when done. Very occasionally, though, we must do other exotic things with the memory, like freeing the list but keeping the strings. Let's provide a detach function so that callers can make use of our API to build up the array, and then take ownership of it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-15argv-array: implement argv_array_pushv()Paul Tan
When we have a null-terminated array, it would be useful to convert it or append it to an argv_array for further manipulation. Implement argv_array_pushv() which will push a null-terminated array of strings on to an argv_array. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-15argv-array: drop "detach" codeJeff King
The argv_array_detach function (and associated free() function) was really only useful for transferring ownership of the memory to a "struct child_process". Now that we have an internal argv_array in that struct, there are no callers left. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12doc: various spelling fixesStefano Lattarini
Most of these were found using Lucas De Marchi's codespell tool. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-25Merge branch 'fa/remote-svn'Jeff King
A GSoC project. * fa/remote-svn: Add a test script for remote-svn remote-svn: add marks-file regeneration Add a svnrdump-simulator replaying a dump file for testing remote-svn: add incremental import remote-svn: Activate import/export-marks for fast-import Create a note for every imported commit containing svn metadata vcs-svn: add fast_export_note to create notes Allow reading svn dumps from files via file:// urls remote-svn, vcs-svn: Enable fetching to private refs When debug==1, start fast-import with "--stats" instead of "--quiet" Add documentation for the 'bidi-import' capability of remote-helpers Connect fast-import to the remote-helper via pipe, adding 'bidi-import' capability Add argv_array_detach and argv_array_free_detached Add svndump_init_fd to allow reading dumps from arbitrary FDs Add git-remote-testsvn to Makefile Implement a remote helper for svn in C
2012-10-07Add argv_array_detach and argv_array_free_detachedFlorian Achleitner
Allow detaching of ownership of the argv_array's contents and add a function to free those detached argv_arrays later. This makes it possible to use argv_array efficiently with the exiting struct child_process which only contains a member char **argv. Add to documentation. Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com> Acked-by: David Michael Barr <b@rr-dav.id.au> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-03argv-array: add pop functionJeff King
Sometimes we build a set of similar command lines, differing only in the final arguments (e.g., "fetch --multiple"). To use argv_array for this, you have to either push the same set of elements repeatedly, or break the abstraction by manually manipulating the array's internal members. Instead, let's provide a sanctioned "pop" function to remove elements from the end. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-18argv-array: add a new "pushl" methodJeff King
It can be convenient to push many strings in a single line (e.g., if you are initializing an array with defaults). This patch provides a convenience wrapper to allow this. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14refactor argv_array into generic codeJeff King
The submodule code recently grew generic code to build a dynamic argv array. Many other parts of the code can reuse this, too, so let's make it generically available. There are two enhancements not found in the original code: 1. We now handle the NULL-termination invariant properly, even when no strings have been pushed (before, you could have an empty, NULL argv). This was not a problem for the submodule code, which always pushed at least one argument, but was not sufficiently safe for generic code. 2. There is a formatted variant of the "push" function. This is a convenience function which was not needed by the submodule code, but will make it easier to port other users to the new code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>