mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 19:42:48 -05:00
Document the split_into_argv functions better.
Even though I wrote them, I keep forgetting their semantics. In particular I can never quite remember off the top of my head whether they modify their input command line, or allocate it fresh. To make that clearer, I've made it a const parameter. (That means the output argstart pointers have the same awkward const -> mutable conversion as strchr - but then, strchr is itself precedent for that being the usual way to not-quite-handle that annoyance in C!)
This commit is contained in:
@ -176,10 +176,10 @@ static inline bool is_word_sep(CHAR c)
|
||||
return c == ' ' || c == '\t';
|
||||
}
|
||||
|
||||
void FUNCTION(CHAR *cmdline, bool includes_program_name,
|
||||
void FUNCTION(const CHAR *cmdline, bool includes_program_name,
|
||||
int *argc, CHAR ***argv, CHAR ***argstart)
|
||||
{
|
||||
CHAR *p;
|
||||
const CHAR *p;
|
||||
CHAR *outputline, *q;
|
||||
CHAR **outputargv, **outputargstart;
|
||||
int outputargc;
|
||||
@ -252,7 +252,7 @@ void FUNCTION(CHAR *cmdline, bool includes_program_name,
|
||||
|
||||
/* We have an argument; start it. */
|
||||
outputargv[outputargc] = q;
|
||||
outputargstart[outputargc] = p;
|
||||
outputargstart[outputargc] = (CHAR *)p;
|
||||
outputargc++;
|
||||
quote = false;
|
||||
|
||||
|
Reference in New Issue
Block a user