Re: [HACKERS] getopt() and strdup()

2012-10-13 Thread Phil Sorber
On Sat, Oct 13, 2012 at 3:14 PM, Tom Lane wrote: > Phil Sorber writes: >> On Wed, Oct 10, 2012 at 7:54 PM, Bruce Momjian wrote: >>> Also, do we want to centralize the definition of pg_strdup() in /port, >>> or leave each module to define it on its own? > >> +1 for a centralized definition. > > T

Re: [HACKERS] getopt() and strdup()

2012-10-13 Thread Tom Lane
Phil Sorber writes: > On Wed, Oct 10, 2012 at 7:54 PM, Bruce Momjian wrote: >> Also, do we want to centralize the definition of pg_strdup() in /port, >> or leave each module to define it on its own? > +1 for a centralized definition. The difficulty with a centralized definition is that it's not

Re: [HACKERS] getopt() and strdup()

2012-10-13 Thread Phil Sorber
On Wed, Oct 10, 2012 at 7:54 PM, Bruce Momjian wrote: > On Mon, Oct 8, 2012 at 09:03:37PM -0400, Bruce Momjian wrote: >> On Mon, Oct 8, 2012 at 04:33:29PM -0400, Tom Lane wrote: >> > Bruce Momjian writes: >> > > A while ago I noticed that in some places we strdup/pg_strdup() optarg >> > > strin

Re: [HACKERS] getopt() and strdup()

2012-10-12 Thread Bruce Momjian
Applied. --- On Wed, Oct 10, 2012 at 07:54:15PM -0400, Bruce Momjian wrote: > On Mon, Oct 8, 2012 at 09:03:37PM -0400, Bruce Momjian wrote: > > On Mon, Oct 8, 2012 at 04:33:29PM -0400, Tom Lane wrote: > > > Bruce Momjian

Re: [HACKERS] getopt() and strdup()

2012-10-10 Thread Bruce Momjian
On Mon, Oct 8, 2012 at 09:03:37PM -0400, Bruce Momjian wrote: > On Mon, Oct 8, 2012 at 04:33:29PM -0400, Tom Lane wrote: > > Bruce Momjian writes: > > > A while ago I noticed that in some places we strdup/pg_strdup() optarg > > > strings from getopt(), and in some places we don't. > > > > > If

Re: [HACKERS] getopt() and strdup()

2012-10-08 Thread Bruce Momjian
On Mon, Oct 8, 2012 at 04:33:29PM -0400, Tom Lane wrote: > Bruce Momjian writes: > > A while ago I noticed that in some places we strdup/pg_strdup() optarg > > strings from getopt(), and in some places we don't. > > > If we needed the strdup(), the missing cases should generate errors. If > > w

Re: [HACKERS] getopt() and strdup()

2012-10-08 Thread Tom Lane
Bruce Momjian writes: > A while ago I noticed that in some places we strdup/pg_strdup() optarg > strings from getopt(), and in some places we don't. > If we needed the strdup(), the missing cases should generate errors. If > we don't need them, the strdup() is unnecessary, and research confirms

Re: [HACKERS] getopt() and strdup()

2012-10-08 Thread Andrew Dunstan
On 10/08/2012 02:40 PM, Bruce Momjian wrote: A while ago I noticed that in some places we strdup/pg_strdup() optarg strings from getopt(), and in some places we don't. If we needed the strdup(), the missing cases should generate errors. If we don't need them, the strdup() is unnecessary, and r