[PATCH i-g-t v1 2/5] runner/settings: Update absolute_path function to accept const char* parameter

Naladala Ramanaidu ramanaidu.naladala at intel.com
Thu Nov 21 13:39:55 UTC 2024


Modified the absolute_path function in settings.c to take a
const char* parameter instead of char*. Updated the corresponding
declaration in settings.h.This change ensures that the input path
is not modified within the function, improving code safety and clarity.

Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
---
 runner/settings.c | 2 +-
 runner/settings.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/runner/settings.c b/runner/settings.c
index 0d27e7af3..dd4b08dd7 100644
--- a/runner/settings.c
+++ b/runner/settings.c
@@ -565,7 +565,7 @@ static char *_basename(const char *path)
 	return tmpname;
 }
 
-char *absolute_path(char *path)
+char *absolute_path(const char *path)
 {
 	char *result = NULL;
 	char *base, *dir;
diff --git a/runner/settings.h b/runner/settings.h
index 8335f0b8c..6246d0c3d 100644
--- a/runner/settings.h
+++ b/runner/settings.h
@@ -135,7 +135,7 @@ bool parse_options(int argc, char **argv,
 bool validate_settings(struct settings *settings);
 
 /* TODO: Better place for this */
-char *absolute_path(char *path);
+char *absolute_path(const char *path);
 
 /**
  * serialize_settings:
-- 
2.43.0



More information about the igt-dev mailing list