[gnome-builder] threading: Make ide_subprocess_launcher_set_argv take const arg list



commit bf3b58244213c996d3ccf199a2f0d355502d47f3
Author: vanadiae <vanadiae35 gmail com>
Date:   Mon Feb 22 18:46:55 2021 +0100

    threading: Make ide_subprocess_launcher_set_argv take const arg list
    
    Everywhere in both GSubprocessLauncher and IdeSubprocessLauncher are
    arguments passed as const char * or const char * const *, to make it
    easier to pass arguments directly as string literals, like "foo", or
    (const char * const *){"foo", "bar", "baz", NULL}.
    
    For this reason, it's a good idea to make set_argv() take fully const
    argv. This doesn't break API/ABI in any way, but it'll throw a warning
    for places where it was explicitely casted to (gchar **), so this commit
    also fixes the only occurence in Builder's code base where a warning was
    thrown.

 src/libide/threading/ide-subprocess-launcher.c | 2 +-
 src/libide/threading/ide-subprocess-launcher.h | 2 +-
 src/plugins/meson/gbp-meson-pipeline-addin.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/threading/ide-subprocess-launcher.c b/src/libide/threading/ide-subprocess-launcher.c
index 2010ce545..6e4ed714e 100644
--- a/src/libide/threading/ide-subprocess-launcher.c
+++ b/src/libide/threading/ide-subprocess-launcher.c
@@ -983,7 +983,7 @@ ide_subprocess_launcher_take_stderr_fd (IdeSubprocessLauncher *self,
  */
 void
 ide_subprocess_launcher_set_argv (IdeSubprocessLauncher  *self,
-                                  gchar                 **args)
+                                  const gchar * const    *args)
 {
   IdeSubprocessLauncherPrivate *priv = ide_subprocess_launcher_get_instance_private (self);
 
diff --git a/src/libide/threading/ide-subprocess-launcher.h b/src/libide/threading/ide-subprocess-launcher.h
index 5e0d1d45c..e1b42a57a 100644
--- a/src/libide/threading/ide-subprocess-launcher.h
+++ b/src/libide/threading/ide-subprocess-launcher.h
@@ -113,7 +113,7 @@ IDE_AVAILABLE_IN_3_32
 gchar                 *ide_subprocess_launcher_pop_argv             (IdeSubprocessLauncher  *self) 
G_GNUC_WARN_UNUSED_RESULT;
 IDE_AVAILABLE_IN_3_32
 void                   ide_subprocess_launcher_set_argv             (IdeSubprocessLauncher  *self,
-                                                                     gchar                 **args);
+                                                                     const gchar * const    *args);
 IDE_AVAILABLE_IN_3_32
 IdeSubprocess         *ide_subprocess_launcher_spawn                (IdeSubprocessLauncher  *self,
                                                                      GCancellable           *cancellable,
diff --git a/src/plugins/meson/gbp-meson-pipeline-addin.c b/src/plugins/meson/gbp-meson-pipeline-addin.c
index 6a5bef6c7..8e9aae305 100644
--- a/src/plugins/meson/gbp-meson-pipeline-addin.c
+++ b/src/plugins/meson/gbp-meson-pipeline-addin.c
@@ -63,7 +63,7 @@ on_build_stage_query (IdePipelineStage *stage,
         break;
     }
   g_ptr_array_add (replace, NULL);
-  ide_subprocess_launcher_set_argv (launcher, (gchar **)replace->pdata);
+  ide_subprocess_launcher_set_argv (launcher, (const gchar * const *)replace->pdata);
 
   /* If we have targets to build, specify them */
   if (targets != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]