From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | "Michael C(dot) Thornburgh" <zenomt(at)armory(dot)com> |
Cc: | tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Re: patch for src/backend/main/main.c |
Date: | 2001-01-24 01:38:38 |
Message-ID: | 200101240138.UAA16443@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
We already use strdup a lot. Want to send a new patch?
>
> that certainly works and is much cleaner, but strdup
> may not be as ubiquitous as malloc & strncpy.
> someone more versed in portability issues than i am
> should speak to that.
>
> -michael thornburgh
>
>
> > From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> >
> > "Michael C. Thornburgh" <zenomt(at)armory(dot)com> writes:
> > > + len = strlen(pw->pw_name);
> > > + pw_name_persist = (char *) malloc(len+1);
> > > + if (pw_name_persist == (char *)NULL)
> > > + {
> > > + fprintf(stderr, "%s: can't malloc for username\n", argv[0]);
> > > + exit(1);
> > > + }
> > > + strncpy(pw_name_persist, pw->pw_name, len+1);
> >
> > This could be simplified to
> > pw_name_persist = strdup(pw->pw_name);
> > no?
> >
> > regards, tom lane
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Alfred Perlstein | 2001-01-24 01:47:29 | Re: Re: patch for src/backend/main/main.c |
Previous Message | Tom Lane | 2001-01-24 00:52:36 | Re: patch for src/backend/main/main.c |