mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
gshell: Mention handling of empty argv arrays in the documentation
It is not possible for `g_shell_parse_argv()` to return an empty `argv` array. Make that clear in the documentation and add some assertions to encode it explicitly in the code. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
11654811ef
commit
18fc711355
@ -646,6 +646,11 @@ tokenize_command_line (const gchar *command_line,
|
||||
*
|
||||
* Possible errors are those from the %G_SHELL_ERROR domain.
|
||||
*
|
||||
* In particular, if @command_line is an empty string (or a string containing
|
||||
* only whitespace), %G_SHELL_ERROR_EMPTY_STRING will be returned. It’s
|
||||
* guaranteed that @argvp will be a non-empty array if this function returns
|
||||
* successfully.
|
||||
*
|
||||
* Free the returned vector with g_strfreev().
|
||||
*
|
||||
* Returns: %TRUE on success, %FALSE if error set
|
||||
@ -703,6 +708,9 @@ g_shell_parse_argv (const gchar *command_line,
|
||||
|
||||
g_slist_free_full (tokens, g_free);
|
||||
|
||||
g_assert (argc > 0);
|
||||
g_assert (argv != NULL && argv[0] != NULL);
|
||||
|
||||
if (argcp)
|
||||
*argcp = argc;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user