Re: [PATCH] config: do not ungetc EOF

2015-02-08 Thread Heiko Voigt
On Thu, Feb 05, 2015 at 04:28:47PM -0500, Jeff King wrote: On Thu, Feb 05, 2015 at 01:16:36PM -0800, Junio C Hamano wrote: Jeff King p...@peff.net writes: On Thu, Feb 05, 2015 at 01:53:27AM -0500, Jeff King wrote: I also notice that config_buf_ungetc does not actually ungetc the

Re: [PATCH] config: do not ungetc EOF

2015-02-08 Thread Heiko Voigt
On Thu, Feb 05, 2015 at 04:00:24PM -0500, Jeff King wrote: On Thu, Feb 05, 2015 at 01:53:27AM -0500, Jeff King wrote: I also notice that config_buf_ungetc does not actually ungetc the character we give it; it just rewinds one character in the stream. This is fine, because we always feed

Re: [PATCH] config: do not ungetc EOF

2015-02-05 Thread Jeff King
On Thu, Feb 05, 2015 at 01:53:27AM -0500, Jeff King wrote: I also notice that config_buf_ungetc does not actually ungetc the character we give it; it just rewinds one character in the stream. This is fine, because we always feed the last-retrieved character. I dunno if it is worth fixing (it

Re: [PATCH] config: do not ungetc EOF

2015-02-05 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Thu, Feb 05, 2015 at 01:53:27AM -0500, Jeff King wrote: I also notice that config_buf_ungetc does not actually ungetc the character we give it; it just rewinds one character in the stream. This is fine, because we always feed the last-retrieved character. I

Re: [PATCH] config: do not ungetc EOF

2015-02-05 Thread Jeff King
On Thu, Feb 05, 2015 at 01:16:36PM -0800, Junio C Hamano wrote: Jeff King p...@peff.net writes: On Thu, Feb 05, 2015 at 01:53:27AM -0500, Jeff King wrote: I also notice that config_buf_ungetc does not actually ungetc the character we give it; it just rewinds one character in the

[PATCH] config: do not ungetc EOF

2015-02-04 Thread Jeff King
When we are parsing a config value, if we see a carriage return, we fgetc the next character to see if it is a line feed (in which case we silently drop the CR). If it isn't, we then ungetc the character, and take the literal CR. But we never check whether we in fact got a character at all. If