From 046e67b700b0600c6e315d7d513e4c74478a2afc Mon Sep 17 00:00:00 2001 From: Darren Hiebert Date: Sun, 15 Aug 2004 17:04:50 +0000 Subject: [PATCH] Fixed bug introduced in previous edit which caused a blank option to be read at end of option file. git-svn-id: https://ctags.svn.sourceforge.net/svnroot/ctags/trunk@415 c5d04d22-be80-434c-894e-aa346cc9e8e8 --- args.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/args.c b/args.c index 3e6bd23c65..1bc67606f1 100644 --- a/args.c +++ b/args.c @@ -138,16 +138,19 @@ static char* nextFileLine (FILE* const fp) break; c = fgetc (fp); } - if (c == '\r') + if (c != EOF || vStringLength (vs) > 0) { - c = fgetc (fp); - if (c != '\n') - c = ungetc (c, fp); + if (c == '\r') + { + c = fgetc (fp); + if (c != '\n') + c = ungetc (c, fp); + } + vStringTerminate (vs); + result = xMalloc (vStringLength (vs) + 1, char); + strcpy (result, vStringValue (vs)); + vStringDelete (vs); } - vStringTerminate (vs); - result = xMalloc (vStringLength (vs) + 1, char); - strcpy (result, vStringValue (vs)); - vStringDelete (vs); } return result; }