diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-05-21 16:54:27 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-22 11:58:50 +0900 |
commit | 342c513a4ae100354097a9ca99a080eeb7e70c0b (patch) | |
tree | 86454cb22bbe18f45869ed4f6a3f50cdcb9ed904 /t/t7064-wtstatus-pv2.sh | |
parent | merge-recursive: provide pair of `unpack_trees_{start,finish}()` (diff) | |
download | tgif-342c513a4ae100354097a9ca99a080eeb7e70c0b.tar.xz |
argv-array: return the pushed string from argv_push*()
Such an API change allows us to use an argv_array this way:
struct argv_array to_free = ARGV_ARRAY_INIT;
const char *msg;
if (some condition) {
msg = "constant string message";
... other logic ...
} else {
msg = argv_array_pushf(&to_free, "format %s", var);
}
... use "msg" ...
... do other things ...
argv_array_clear(&to_free);
Note that argv_array_pushl() and argv_array_pushv() are used to push
one or more strings with a single call, so we do not return any one
of these strings from these two functions in order to reduce the
chance to misuse the API.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Martin Ă…gren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7064-wtstatus-pv2.sh')
0 files changed, 0 insertions, 0 deletions