[PATCH i-g-t v2 2/5] runner/settings: Constify absolute_path parameter

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Jan 16 12:29:10 UTC 2025


Hi Naladala,
On 2025-01-08 at 01:36:11 +0530, Naladala Ramanaidu wrote:
> Modified absolute_path to use const char* for input, updating the
> corresponding declaration. This ensures the input path remains
> unmodified, enhancing code safety and clarity.
> 
imho better:

Make absolute_path a const char*, this ensures the input path remains
unmodified, enhancing code safety and clarity.

with that:
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> v2: Update commit subject.  (kmail)
> 
> 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 92fd42ea6..bea0c3059 100644
> --- a/runner/settings.c
> +++ b/runner/settings.c
> @@ -567,7 +567,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 f69f09778..7e6cd11e2 100644
> --- a/runner/settings.h
> +++ b/runner/settings.h
> @@ -136,7 +136,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