Re: Reduce the number of special cases to build contrib modules on windows - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Reduce the number of special cases to build contrib modules on windows
Date
Msg-id 202107271501.eqzjxmk4tskr@alvherre.pgsql
Whole thread Raw
In response to Re: Reduce the number of special cases to build contrib modules on windows  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Reduce the number of special cases to build contrib modules on windows
Re: Reduce the number of special cases to build contrib modules on windows
List pgsql-hackers
On 2021-Jul-28, David Rowley wrote:

> 0003: Is a tidy up patch to make the 'includes' field an array rather
> than a string

In this one, you can avoid turning one line into four with map,

-    $p->AddIncludeDir($pl_proj->{includes});
+    foreach my $inc (@{ $pl_proj->{includes} })
+    {
+        $p->AddIncludeDir($inc);
+    }

Instead of that you can do something like this:

+    map { $p->AddIncludeDir($_); } @{$pl_proj->{includes}};

> 0004: Adds code to check for duplicate references and libraries before
> adding new ones of the same name to the project.

I think using the return value of grep as a boolean is confusing.  It
seems more legible to compare to 0.  So instead of this:

+        if (! grep { $_ eq $ref} @{ $self->{references} })
+        {
+            push @{ $self->{references} }, $ref;
+        }

use something like:

+        if (grep { $_ eq $ref} @{ $self->{references} } == 0)


> 0006: I'm not so sure about. It attempts to do a bit more Makefile
> parsing to get rid of contrib_extrasource and the majority of
> contrib_uselibpgport and contrib_uselibpgcommon usages.

I wonder if we could fix up libpq_pipeline's Makefile somehow to get rid
of the remaining ones.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_settings.pending_restart not set when line removed
Next
From: Robert Haas
Date:
Subject: Re: needless complexity in StartupXLOG