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

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Dec 11 09:42:52 UTC 2024


Hi Naladala,
On 2024-11-21 at 19:09:55 +0530, Naladala Ramanaidu wrote:

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

Please make it a little shorter and more descriptive, like
[PATCH i-g-t v1 2/5] runner/settings: constify absolute_path parameter

> 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.

This looks a little too long and also like "C to words",
read CONTRIBUTE.md for pointers how to write patch descriptions.

Reagrds,
Kamil

> 
> 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