summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-08-15 08:37:14 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-08-17 10:19:35 +1000
commit43bdab62ed12dba83add8caeafb09b73491c9e26 (patch)
treea3bcbf8e400d0e02b9e17d9250aa25a24ebb1b9e /include
parent98bacb5fe9405c5ef0b8938ddb828df9d3b0784e (diff)
process: require NULL as last argument to Start()
And handle empty arguments and NULL_terminated arguments. This is a better API than require the user to pass empty strings, especially since in some cases an empty string may be a valid argument. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'include')
-rw-r--r--include/xorg/gtest/xorg-gtest-process.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/xorg/gtest/xorg-gtest-process.h b/include/xorg/gtest/xorg-gtest-process.h
index 48f387b..b4ac0d9 100644
--- a/include/xorg/gtest/xorg-gtest-process.h
+++ b/include/xorg/gtest/xorg-gtest-process.h
@@ -30,6 +30,7 @@
#define XORG_GTEST_PROCESS_H
#include <stdarg.h>
+#include <X11/Xfuncproto.h> /* for _X_SENTINEL */
#include <memory>
#include <string>
@@ -114,7 +115,7 @@ class Process {
*
* @param program The program to start.
* @param args Variadic list of arguments passed to the program. This list
- * must end in a zero-length string ("", not NULL).
+ * must end with NULL.
*
* @throws std::runtime_error on failure.
*
@@ -127,7 +128,7 @@ class Process {
* Starts a program as a child process.
*
* Takes a variadic list of arguments passed to the program. This list
- * must end in a zero-length string ("", not NULL).
+ * must end with NULL.
* See 'man execvp' for further information on the variadic argument list.
*
* @param program The program to start.
@@ -137,7 +138,7 @@ class Process {
* @post If successful: Child process forked and program started.
* @post If successful: Subsequent calls to Pid() return child process pid.
*/
- void Start(const std::string& program, ...);
+ void Start(const std::string& program, ...) _X_SENTINEL(0);
/**
* Terminates (SIGTERM) this child process and waits a given timeout for