Thread

Commits

  1. pg_upgrade: Avoid shadowing global var in function

  1. pg_upgrade - a function parameter shadows global 'new_cluster'

    Peter Smith <smithpb2250@gmail.com> — 2023-08-23T01:28:25Z

    Hi hackers.
    
    During a recent review of nearby code I noticed that there was a shadowing
    of the 'new_cluster' global variable by a function parameter:
    
    Here:
    static void check_for_new_tablespace_dir(ClusterInfo *new_cluster);
    
    ~~~
    
    It looks like it has been like this for a couple of years. I guess this
    might have been found/fixed earlier had the code been compiled differently:
    
    check.c: In function ‘check_for_new_tablespace_dir’:
    check.c:381:43: warning: declaration of ‘new_cluster’ shadows a global
    declaration [-Wshadow]
     check_for_new_tablespace_dir(ClusterInfo *new_cluster)
                                               ^
    In file included from check.c:16:0:
    pg_upgrade.h:337:4: warning: shadowed declaration is here [-Wshadow]
        new_cluster;
        ^
    
    ~~~
    
    PSA a small patch to remove the unnecessary parameter, and so eliminate
    this shadowing.
    
    Thoughts?
    
    ------
    Kind Regards,
    Peter Smith.
    Fujitsu Australia.
    
  2. Re: pg_upgrade - a function parameter shadows global 'new_cluster'

    Daniel Gustafsson <daniel@yesql.se> — 2023-08-23T08:00:13Z

    > On 23 Aug 2023, at 03:28, Peter Smith <smithpb2250@gmail.com> wrote:
    
    > PSA a small patch to remove the unnecessary parameter, and so eliminate this shadowing.
    
    Agreed, applied. Thanks!
    
    --
    Daniel Gustafsson
    
    
    
    
    
  3. Re: pg_upgrade - a function parameter shadows global 'new_cluster'

    Peter Smith <smithpb2250@gmail.com> — 2023-08-23T23:07:55Z

    On Wed, Aug 23, 2023 at 6:00 PM Daniel Gustafsson <daniel@yesql.se> wrote:
    
    > > On 23 Aug 2023, at 03:28, Peter Smith <smithpb2250@gmail.com> wrote:
    >
    > > PSA a small patch to remove the unnecessary parameter, and so eliminate
    > this shadowing.
    >
    > Agreed, applied. Thanks!
    >
    >
    Thanks for pushing!
    
    ------
    Kind Regards,
    Peter Smith.
    Fujitsu Australia