Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Nicolas Pitre
On Tue, 14 Jun 2016, Lukas Fleischer wrote: > On Tue, 14 Jun 2016 at 19:55:06, Nicolas Pitre wrote: > > It is not buffered as it writes to stderr. And some C libs do separate > > calls to write() for every string format specifier. So "%s%s%c" may end > > up calling write() 3 times depending on

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Junio C Hamano
Lukas Fleischer writes: > One possible solution is using strbuf and constructing the message as we > did before. However, that still relies on fprintf() only calling write() > once per format specifier. While that is probably true for all existing > implementations, I don't

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Lukas Fleischer
On Tue, 14 Jun 2016 at 20:11:12, Junio C Hamano wrote: > Nicolas Pitre writes: > > > It is not buffered as it writes to stderr. And some C libs do separate > > calls to write() for every string format specifier. So "%s%s%c" may end > > up calling write() 3 times depending on

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Junio C Hamano
Nicolas Pitre writes: > It is not buffered as it writes to stderr. And some C libs do separate > calls to write() for every string format specifier. So "%s%s%c" may end > up calling write() 3 times depending on the implementation. The example > I gave in commit ed1902ef5c

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Nicolas Pitre
On Tue, 14 Jun 2016, Lukas Fleischer wrote: > Hi Nicolas, > > On Tue, 14 Jun 2016 at 19:09:15, Nicolas Pitre wrote: > > I just looked again at all the contraptions _I_ wrote (not Junio's) for > > a reason why I went to such extremes in making this code co complicated. > > > > One aspect that

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Nicolas Pitre
On Mon, 13 Jun 2016, Nicolas Pitre wrote: > On Mon, 13 Jun 2016, Lukas Fleischer wrote: > > > Improve the readability of recv_sideband() significantly by replacing > > fragile buffer manipulations with more sophisticated format strings. > > Also, reorganize the overall control flow, remove some

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Nicolas Pitre
On Tue, 14 Jun 2016, Johannes Schindelin wrote: > Hi Nico, > > On Tue, 14 Jun 2016, Nicolas Pitre wrote: > > > On Tue, 14 Jun 2016, Johannes Schindelin wrote: > > > > > On Mon, 13 Jun 2016, Nicolas Pitre wrote: > > > > > > > On Mon, 13 Jun 2016, Lukas Fleischer wrote: > > > > > > > > >

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Johannes Schindelin
Hi Nico, On Tue, 14 Jun 2016, Nicolas Pitre wrote: > On Tue, 14 Jun 2016, Johannes Schindelin wrote: > > > On Mon, 13 Jun 2016, Nicolas Pitre wrote: > > > > > On Mon, 13 Jun 2016, Lukas Fleischer wrote: > > > > > > > Improve the readability of recv_sideband() significantly by > > > >

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Nicolas Pitre
On Tue, 14 Jun 2016, Johannes Schindelin wrote: > Hi, > > On Mon, 13 Jun 2016, Nicolas Pitre wrote: > > > On Mon, 13 Jun 2016, Lukas Fleischer wrote: > > > > > Improve the readability of recv_sideband() significantly by replacing > > > fragile buffer manipulations with more sophisticated

Re: [PATCH] Refactor recv_sideband()

2016-06-14 Thread Johannes Schindelin
Hi, On Mon, 13 Jun 2016, Nicolas Pitre wrote: > On Mon, 13 Jun 2016, Lukas Fleischer wrote: > > > Improve the readability of recv_sideband() significantly by replacing > > fragile buffer manipulations with more sophisticated format strings. > > Also, reorganize the overall control flow, remove

Re: [PATCH] Refactor recv_sideband()

2016-06-13 Thread Nicolas Pitre
On Mon, 13 Jun 2016, Lukas Fleischer wrote: > Improve the readability of recv_sideband() significantly by replacing > fragile buffer manipulations with more sophisticated format strings. > Also, reorganize the overall control flow, remove some superfluous > variables and replace a custom

[PATCH] Refactor recv_sideband()

2016-06-13 Thread Lukas Fleischer
Improve the readability of recv_sideband() significantly by replacing fragile buffer manipulations with more sophisticated format strings. Also, reorganize the overall control flow, remove some superfluous variables and replace a custom implementation of strpbrk() with a call to the standard C