Re: Win32 fix for pg_dumpall
От | Andrew Dunstan |
---|---|
Тема | Re: Win32 fix for pg_dumpall |
Дата | |
Msg-id | 4116325B.7060504@dunslane.net обсуждение исходный текст |
Ответ на | Win32 fix for pg_dumpall (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: Win32 fix for pg_dumpall
Re: Win32 fix for pg_dumpall |
Список | pgsql-patches |
Bruce Momjian wrote: > > /* >+ * Sometime the child returns "\r\n", which doesn't match >+ * our version string. The backend uses >+ * setvbuf(stdout, NULL, _IONBF, 0), but pg_dump doesn't >+ * so we have to fix it here. >+ */ >+ if (strlen(line) >= 2 && >+ line[strlen(line)-2] == '\r' && >+ line[strlen(line)-1] == '\n') >+ { >+ line[strlen(line)-2] == '\n'; >+ line[strlen(line)-1] == '\0'; >+ } >+ >+ /* > > > I do not see how the comment relates at all to the code following it - buffer mode and line end mode are two different things. Also, the repeated calls to strlen(line) are horribly inefficient - it should be called once and stashed in an int (I once made an order of magnitude speedup in a program by correcting a piece of someone else's code that looked like this: for (i = 0; i <= strlen(s); i++) where s was an invariant very long string) cheers andrew
В списке pgsql-patches по дате отправления: