lttng-view: clean-up: static struct viewers array should be const
[lttng-tools.git] / src / bin / lttng / commands / view.c
index 237ea4a15675d775150ef17d3147124398fb11de..7900ea2de5347c1236b8db1bdc346f1586f72637 100644 (file)
@@ -30,7 +30,6 @@ static char *opt_session_name;
 static char *opt_viewer;
 static char *opt_trace_path;
 static const char *babeltrace_bin = CONFIG_BABELTRACE_BIN;
-//static const char *lttv_gui_bin = CONFIG_LTTV_GUI_BIN;
 
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
@@ -56,7 +55,6 @@ static struct poptOption long_options[] = {
  * This is needed for each viewer since we are using execvp().
  */
 static const char *babeltrace_opts[] = { "babeltrace" };
-//static const char *lttv_gui_opts[] = { "lttv-gui", "-t", };
 
 /*
  * Type is also use as the index in the viewers array. So please, make sure
@@ -64,27 +62,25 @@ static const char *babeltrace_opts[] = { "babeltrace" };
  */
 enum viewer_type {
        VIEWER_BABELTRACE    = 0,
-       VIEWER_LTTV_GUI      = 1,
-       VIEWER_USER_DEFINED  = 2,
+       VIEWER_USER_DEFINED  = 1,
 };
 
 /*
  * NOTE: "lttv" is a shell command and it's not working for exec() family
  * functions so we might think of removing this wrapper or using bash.
  */
-static struct viewers {
+static const struct viewers {
        const char *exec_name;
        enum viewer_type type;
 } viewers[] = {
        { "babeltrace", VIEWER_BABELTRACE },
-       { "lttv-gui", VIEWER_LTTV_GUI },
        { NULL, VIEWER_USER_DEFINED },
 };
 
 /* Is the session we are trying to view is in live mode. */
 static int session_live_mode;
 
-static struct viewers *parse_options(void)
+static const struct viewers *parse_options(void)
 {
        if (opt_viewer == NULL) {
                /* Default is babeltrace */
@@ -188,7 +184,7 @@ static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len,
                goto error;
        }
 
-       memcpy(argv, opts, opts_len);
+       memcpy(argv, opts, sizeof(char *) * opts_len);
 
        if (session_live_mode) {
                argv[opts_len] = "-i";
@@ -212,7 +208,7 @@ static int spawn_viewer(const char *trace_path)
        int ret = 0;
        struct stat status;
        const char *viewer_bin = NULL;
-       struct viewers *viewer;
+       const struct viewers *viewer;
        char **argv = NULL;
 
        /* Check for --viewer options */
This page took 0.02429 seconds and 4 git commands to generate.