[gnome-builder/wip/chergert/pipeline-merge: 7/78] subprocess: special case NULL args
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/pipeline-merge: 7/78] subprocess: special case NULL args
- Date: Fri, 10 Feb 2017 03:27:42 +0000 (UTC)
commit 62226021389e4a5a4622279d138eb720d2f8cf4d
Author: Christian Hergert <chergert redhat com>
Date: Fri Feb 3 12:17:00 2017 -0800
subprocess: special case NULL args
This can be convenient in a few cases to remove extra NULL checks in
caller code.
libide/subprocess/ide-subprocess-launcher.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/libide/subprocess/ide-subprocess-launcher.c b/libide/subprocess/ide-subprocess-launcher.c
index fcbd7fd..3229402 100644
--- a/libide/subprocess/ide-subprocess-launcher.c
+++ b/libide/subprocess/ide-subprocess-launcher.c
@@ -672,17 +672,25 @@ ide_subprocess_launcher_overlay_environment (IdeSubprocessLauncher *self,
/**
* ide_subprocess_launcher_push_args:
- * @args: (array zero-terminated=1) (element-type utf8): the arguments
+ * @self: A #IdeSubprocessLauncher
+ * @args: (array zero-terminated=1) (element-type utf8) (nullable): the arguments
+ *
+ * This function is semantically identical to calling ide_subprocess_launcher_push_argv()
+ * for each element of @args.
+ *
+ * If @args is %NULL, this function does nothing.
*/
void
ide_subprocess_launcher_push_args (IdeSubprocessLauncher *self,
const gchar * const *args)
{
g_return_if_fail (IDE_IS_SUBPROCESS_LAUNCHER (self));
- g_return_if_fail (args != NULL);
- for (guint i = 0; args [i] != NULL; i++)
- ide_subprocess_launcher_push_argv (self, args [i]);
+ if (args != NULL)
+ {
+ for (guint i = 0; args [i] != NULL; i++)
+ ide_subprocess_launcher_push_argv (self, args [i]);
+ }
}
gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]