On Sat, Jun 27, 2026 at 10:43 AM Filip Kastl <[email protected]> wrote:
>
> In my previous patch I changed a parameter of extract_quoted_files
> from const char * to just char *.  I believe that's still the right call
> but I overlooked that a string literal gets assigned to that variable
> inside the function body.  That means we throw away constness of that
> string literal and produce a warning during compilation of fixincl.c.
>
> This patch fixes this by using a helper const char * variable.
>
> Regtested and bootstrapped on x86_64 linux.
>
> fixincludes/ChangeLog:
>
>         * fixincl.c (extract_quoted_files): Add a const char * helper
>         variable.

Ok.

>
> Signed-off-by: Filip Kastl <[email protected]>
> ---
>  fixincludes/fixincl.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c
> index 2c36a9a30d1..e227665f3cf 100644
> --- a/fixincludes/fixincl.c
> +++ b/fixincludes/fixincl.c
> @@ -741,18 +741,19 @@ quoted_file_exists (const char* pz_src_path,
>
>  static void
>  extract_quoted_files (char* pz_data,
> -                      char* pz_fixed_file,
> +                      char* pz_file,
>                        regmatch_t* p_re_match)
>  {
> -  char *pz_dir_end = strrchr (pz_fixed_file, '/');
> +  char *pz_dir_end = strrchr (pz_file, '/');
>    char *pz_incl_quot = pz_data;
>
>    if (VLEVEL( VERB_APPLIES ))
> -    fprintf (stderr, "Quoted includes in %s\n", pz_fixed_file);
> +    fprintf (stderr, "Quoted includes in %s\n", pz_file);
>
>    /*  Set "pz_fixed_file" to point to the containing subdirectory of the 
> source
>        If there is none, then it is in our current directory, ".".   */
>
> +  const char *pz_fixed_file = pz_file;
>    if (pz_dir_end == (char *) NULL)
>      pz_fixed_file = ".";
>    else
> --
> 2.54.0
>

Reply via email to