Re: Win32 testing needed
Andreas Pflug <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.devel.win32 |
|---|---|
| Message-ID | <[email protected]> |
Tom Lane wrote: > Andreas Pflug <[email protected]> writes: > > Agreed (although actually I was thinking of preserving > write_syslogger_file as the externally visible name and renaming the > existing function to a static "write_syslogger_file_binary" or some such > --- fewer files to touch that way). Do you have time to write and check > this today? I could write it but am not in a good position to test it. The attached code snippet works. I hesitated to use palloc(count*2) to avoid problems in low mem conditions; might be paranoid. Regards, Andreas ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
write_syslogger.c
(text/x-csrc, 358 B)
void
write_syslogger_file(const char *buffer, int count)
{
char convbuf[1024+1], *p=convbuf;
int i;
for (i=0 ; *buffer != 0 && i < 1024 && count > 0 ; i++, count--)
{
if (*buffer == '\n')
{
i++;
*p++ = '\r';
}
*p++ = *buffer++;
}
write_syslogger_file_binary(convbuf, i);
}