Fix: create_output_path() relayd util is not const-correct
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 6 Mar 2018 22:07:46 +0000 (17:07 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 6 Mar 2018 22:09:30 +0000 (17:09 -0500)
Code using this utility assumes that the path name passed to
this function is not modified. Using 'const' enforces this
assumption.

Moreover, this change makes it easier to write const-correct
code in the relayd.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/utils.c
src/bin/lttng-relayd/utils.h

index 51fe19348d09f1378999d5ab3b6041b856f6132c..837c828d22b935cb7eb353a60f6d3e93f2dc277d 100644 (file)
@@ -29,7 +29,7 @@
 #include "lttng-relayd.h"
 #include "utils.h"
 
-static char *create_output_path_auto(char *path_name)
+static char *create_output_path_auto(const char *path_name)
 {
        int ret;
        char *traces_path = NULL;
@@ -58,7 +58,7 @@ exit:
        return traces_path;
 }
 
-static char *create_output_path_noauto(char *path_name)
+static char *create_output_path_noauto(const char *path_name)
 {
        int ret;
        char *traces_path = NULL;
@@ -84,7 +84,7 @@ exit:
  *
  * Return the allocated string containing the path name or else NULL.
  */
-char *create_output_path(char *path_name)
+char *create_output_path(const char *path_name)
 {
        assert(path_name);
 
index 4a56980e47e7dbbeb7d0b584ab24d32ef3174fd8..f0b618420ab56d4da52265a2951db818463ef84c 100644 (file)
@@ -20,6 +20,6 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-char *create_output_path(char *path_name);
+char *create_output_path(const char *path_name);
 
 #endif /* RELAYD_UTILS_H */
This page took 0.031734 seconds and 4 git commands to generate.