PATH:
usr
/
share
/
doc
/
git-1.8.3.1
/
technical
argv-array API ============== The argv-array API allows one to dynamically build and store NULL-terminated lists. An argv-array maintains the invariant that the `argv` member always points to a non-NULL array, and that the array is always NULL-terminated at the element pointed to by `argv[argc]`. This makes the result suitable for passing to functions expecting to receive argv from main(), or the link:api-run-command.html[run-command API]. The link:api-string-list.html[string-list API] is similar, but cannot be used for these purposes; instead of storing a straight string pointer, it contains an item structure with a `util` field that is not compatible with the traditional argv interface. Each `argv_array` manages its own memory. Any strings pushed into the array are duplicated, and all memory is freed by argv_array_clear(). Data Structures --------------- `struct argv_array`:: A single array. This should be initialized by assignment from `ARGV_ARRAY_INIT`, or by calling `argv_array_init`. The `argv` member contains the actual array; the `argc` member contains the number of elements in the array, not including the terminating NULL. Functions --------- `argv_array_init`:: Initialize an array. This is no different than assigning from `ARGV_ARRAY_INIT`. `argv_array_push`:: Push a copy of a string onto the end of the array. `argv_array_pushl`:: Push a list of strings onto the end of the array. The arguments should be a list of `const char *` strings, terminated by a NULL argument. `argv_array_pushf`:: Format a string and push it onto the end of the array. This is a convenience wrapper combining `strbuf_addf` and `argv_array_push`. `argv_array_pop`:: Remove the final element from the array. If there are no elements in the array, do nothing. `argv_array_clear`:: Free all memory associated with the array and return it to the initial, empty state. `argv_array_detach`:: Detach the argv array from the `struct argv_array`, transferring ownership of the allocated array and strings. `argv_array_free_detached`:: Free the memory allocated by a `struct argv_array` that was later detached and is now no longer needed.
[-] api-strbuf.html
[edit]
[-] api-credentials.txt
[edit]
[-] shallow.txt
[edit]
[-] api-sigchain.html
[edit]
[-] racy-git.html
[edit]
[-] api-allocation-growing.txt
[edit]
[-] api-tree-walking.html
[edit]
[-] index-format.txt
[edit]
[-] pack-protocol.html
[edit]
[-] api-setup.txt
[edit]
[-] api-lockfile.html
[edit]
[-] api-directory-listing.txt
[edit]
[-] api-remote.txt
[edit]
[-] pack-format.html
[edit]
[-] api-quote.txt
[edit]
[-] index-format.html
[edit]
[-] api-in-core-index.txt
[edit]
[-] api-hash.txt
[edit]
[-] send-pack-pipeline.html
[edit]
[-] api-strbuf.txt
[edit]
[+]
..
[-] protocol-common.html
[edit]
[-] pack-heuristics.html
[edit]
[-] api-sha1-array.html
[edit]
[-] api-xdiff-interface.html
[edit]
[-] api-xdiff-interface.txt
[edit]
[-] api-hashmap.html
[edit]
[-] api-ref-iteration.txt
[edit]
[-] trivial-merge.html
[edit]
[-] api-gitattributes.txt
[edit]
[-] pack-format.txt
[edit]
[-] api-run-command.txt
[edit]
[-] api-parse-options.html
[edit]
[-] api-ref-iteration.html
[edit]
[-] trivial-merge.txt
[edit]
[-] api-decorate.txt
[edit]
[-] api-builtin.txt
[edit]
[-] api-directory-listing.html
[edit]
[-] pack-protocol.txt
[edit]
[-] api-hash.html
[edit]
[-] api-quote.html
[edit]
[-] api-setup.html
[edit]
[-] api-argv-array.html
[edit]
[-] api-remote.html
[edit]
[-] api-grep.txt
[edit]
[-] protocol-capabilities.txt
[edit]
[-] api-revision-walking.html
[edit]
[-] api-string-list.txt
[edit]
[-] api-history-graph.txt
[edit]
[-] api-diff.html
[edit]
[-] protocol-common.txt
[edit]
[-] api-sigchain.txt
[edit]
[-] api-gitattributes.html
[edit]
[-] api-grep.html
[edit]
[-] api-history-graph.html
[edit]
[-] api-lockfile.txt
[edit]
[-] api-index.txt
[edit]
[-] api-revision-walking.txt
[edit]
[-] api-sha1-array.txt
[edit]
[-] api-string-list.html
[edit]
[-] api-object-access.txt
[edit]
[-] api-hashmap.txt
[edit]
[-] protocol-capabilities.html
[edit]
[-] api-object-access.html
[edit]
[-] pack-heuristics.txt
[edit]
[-] shallow.html
[edit]
[-] api-run-command.html
[edit]
[-] racy-git.txt
[edit]
[-] api-merge.html
[edit]
[-] api-index-skel.txt
[edit]
[-] api-tree-walking.txt
[edit]
[-] send-pack-pipeline.txt
[edit]
[-] api-in-core-index.html
[edit]
[-] api-diff.txt
[edit]
[-] api-index.html
[edit]
[-] api-credentials.html
[edit]
[-] api-builtin.html
[edit]
[-] api-allocation-growing.html
[edit]
[-] api-merge.txt
[edit]
[-] api-parse-options.txt
[edit]
[-] api-config.html
[edit]
[-] api-decorate.html
[edit]
[-] api-index.sh
[edit]
[-] api-argv-array.txt
[edit]
[-] api-config.txt
[edit]