summaryrefslogtreecommitdiff
path: root/remote.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-07-28 20:23:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-07-28 22:02:17 (GMT)
commit873cd28a8b17ff21908c78c7929a7615f8c94992 (patch)
treef9daec6b9851a6f4373f0a029903fb3ad04ec23b /remote.h
parent819f0e76b110458488c41741b0dcd538483848c0 (diff)
downloadgit-873cd28a8b17ff21908c78c7929a7615f8c94992.zip
git-873cd28a8b17ff21908c78c7929a7615f8c94992.tar.gz
git-873cd28a8b17ff21908c78c7929a7615f8c94992.tar.bz2
argv-array: rename to strvec
The name "argv-array" isn't very good, because it describes what the data type can be used for (program argument arrays), not what it actually is (a dynamically-growing string array that maintains a NULL-terminator invariant). This leads to people being hesitant to use it for other cases where it would actually be a good fit. The existing name is also clunky to use. It's overly long, and the name often leads to saying things like "argv.argv" (i.e., the field names overlap with variable names, since they're describing the use, not the type). Let's give it a more neutral name. I settled on "strvec" because "vector" is the name for a dynamic array type in many programming languages. "strarray" would work, too, but it's longer and a bit more awkward to say (and don't we all say these things in our mind as we type them?). A more extreme direction would be a generic data structure which stores a NULL-terminated of _any_ type. That would be easy to do with void pointers, but we'd lose some type safety for the existing cases. Plus it raises questions about memory allocation and ownership. So I limited myself here to changing names only, and not semantics. If we do find a use for that more generic data type, we could perhaps implement it at a lower level and then provide type-safe wrappers around it for strings. But that can come later. This patch does the minimum to convert the struct and function names in the header and implementation, leaving a few things for follow-on patches: - files retain their original names for now - struct field names are retained for now - there's a preprocessor compat layer that lets most users remain the same for now. The exception is headers which made a manual forward declaration of the struct. I've converted them (and their dependent function declarations) here. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.h')
-rw-r--r--remote.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/remote.h b/remote.h
index 5cc26c1..5e3ea5a 100644
--- a/remote.h
+++ b/remote.h
@@ -168,7 +168,7 @@ void free_refs(struct ref *ref);
struct oid_array;
struct packet_reader;
-struct argv_array;
+struct strvec;
struct string_list;
struct ref **get_remote_heads(struct packet_reader *reader,
struct ref **list, unsigned int flags,
@@ -178,7 +178,7 @@ struct ref **get_remote_heads(struct packet_reader *reader,
/* Used for protocol v2 in order to retrieve refs from a remote */
struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
struct ref **list, int for_push,
- const struct argv_array *ref_prefixes,
+ const struct strvec *ref_prefixes,
const struct string_list *server_options,
int stateless_rpc);