spawn-viewer: silence bogus warning on gcc 5.4.0 PPC32
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 5 Mar 2021 16:10:38 +0000 (11:10 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 5 Mar 2021 16:15:25 +0000 (11:15 -0500)
gcc 5.4.0 warns that saveptr is used uninitialized, but the use here
with strtok_r is fine, as documented in STRTOK(3). `saveptr` is merely
used as a return value when `str` is non-NULL.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1e47cb633f09978ebf9159f07dfacb8bef27a616

src/common/spawn-viewer.c

index 1d668157f729e11e47f5fb199976c0b0a0b771d1..4ca0ce1a2f45a92c8e1772c906355ce05de558ce 100644 (file)
@@ -69,7 +69,7 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path)
 {
        int i = 0, ignore_space = 0;
        unsigned int num_opts = 1;
-       char **argv, *token = opts, *saveptr;
+       char **argv, *token = opts, *saveptr = NULL;
 
        /* Count number of arguments. */
        do {
This page took 0.033348 seconds and 4 git commands to generate.