Update comments for expand_wildcards functions.

Be more specific in the description of mch_expand_wildcards():
This function will never free memory pointed to by its arguments.
If OK is returned, *file will always point to allocated memory.
*num_file is set to the number of pointers in *file.
If FAIL is returned *file is set to NULL and *num_file to 0.

If gen_expand_wildcards() returns FAIL, no memory allocation in this
function needs to be undone.

If expand_wildcards() returns FAIL, no memory allocation in this
function needs to be undone.

Helped-by: Eliseo Martínez <eliseomarmol@gmail.com>
Helped-by: Michael Reed <m.reed@mykolab.com>
This commit is contained in:
oni-link
2015-03-24 16:54:00 +01:00
committed by Justin M. Keyes
parent d3bb177f1e
commit adb3ec2026
3 changed files with 68 additions and 58 deletions

View File

@@ -3810,16 +3810,17 @@ void ExpandGeneric(
reset_expand_highlight();
}
/*
* Complete a shell command.
*/
static void
expand_shellcmd (
char_u *filepat, /* pattern to match with command names */
int *num_file, /* return: number of matches */
char_u ***file, /* return: array with matches */
int flagsarg /* EW_ flags */
)
/// Complete a shell command.
///
/// @param filepat is a pattern to match with command names.
/// @param[out] num_file is pointer to number of matches.
/// @param[out] file is pointer to array of pointers to matches.
/// *file will either be set to NULL or point to
/// allocated memory.
/// @param flagsarg is a combination of EW_* flags.
static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
int flagsarg)
FUNC_ATTR_NONNULL_ALL
{
char_u *pat;
int i;