mirror of
https://github.com/git/git.git
synced 2024-12-05 07:53:59 +08:00
873cd28a8b
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>
17 lines
475 B
C
17 lines
475 B
C
#ifndef GIT_EXEC_CMD_H
|
|
#define GIT_EXEC_CMD_H
|
|
|
|
struct strvec;
|
|
|
|
void git_set_exec_path(const char *exec_path);
|
|
void git_resolve_executable_dir(const char *path);
|
|
const char *git_exec_path(void);
|
|
void setup_path(void);
|
|
const char **prepare_git_cmd(struct strvec *out, const char **argv);
|
|
int execv_git_cmd(const char **argv); /* NULL terminated */
|
|
LAST_ARG_MUST_BE_NULL
|
|
int execl_git_cmd(const char *cmd, ...);
|
|
char *system_path(const char *path);
|
|
|
|
#endif /* GIT_EXEC_CMD_H */
|