From: | "Karl O(dot) Pinc" <kop(at)meme(dot)com> |
---|---|
To: | Gilles Darold <gilles(dot)darold(at)dalibo(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Christoph Berg <myon(at)debian(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Patch to implement pg_current_logfile() function |
Date: | 2016-12-10 05:36:12 |
Message-ID: | 20161209233612.464cd81d@slate.meme.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Gilles,
On Fri, 9 Dec 2016 23:41:25 +0100
Gilles Darold <gilles(dot)darold(at)dalibo(dot)com> wrote:
> /* extract log format and log file path from the line */
> log_filepath = strchr(lbuffer, ' ');
> log_filepath++;
> lbuffer[log_filepath-lbuffer-1] = '\0';
> log_format = lbuffer;
> *strchr(log_filepath, '\n') = '\0';
Instead I propose (code I have not actually executed):
...
char lbuffer[MAXPGPATH];
char *log_format = lbuffer;
...
/* extract log format and log file path from the line */
log_filepath = strchr(lbuffer, ' '); /* lbuffer == log_format */
*log_filepath = '\0'; /* terminate log_format */
log_filepath++; /* start of file path */
log_filepath[strcspn(log_filepath, "\n")] = '\0';
My first thought was to follow your example and begin with
log_format = lbuffer;
But upon reflection I think changing the declaration of log_format
to use an initializer better expresses how storage is always shared.
Regards,
Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2016-12-10 06:11:26 | Re: proposal: psql statements \gstore \gstore_binary (instead COPY RAW) |
Previous Message | Andrew Dunstan | 2016-12-10 03:25:38 | Re: Time to retire Windows XP buildfarm host? |