[geany/geany] ba2209: Rename readLine() to readLineRaw()

Jiří Techet git-noreply at xxxxx
Sat Sep 10 07:26:06 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sat, 30 Jul 2016 11:10:10 UTC
Commit:      ba2209e4a614731f7b1035af225bd9d2f1dcff07
             https://github.com/geany/geany/commit/ba2209e4a614731f7b1035af225bd9d2f1dcff07

Log Message:
-----------
Rename readLine() to readLineRaw()

Plus make some minor changes in its implementation to match uctags.


Modified Paths:
--------------
    ctags/main/entry.c
    ctags/main/lregex.c
    ctags/main/parse.c
    ctags/main/read.c
    ctags/main/read.h
    ctags/main/sort.c
    ctags/main/strlist.c

Modified: ctags/main/entry.c
8 lines changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -212,7 +212,7 @@ static long unsigned int updatePseudoTags (MIO *const mio)
 	Assert (classLength < maxClassLength);
 
 	mio_getpos (mio, &startOfLine);
-	line = readLine (TagFile.vLine, mio);
+	line = readLineRaw (TagFile.vLine, mio);
 	while (line != NULL  &&  line [0] == class [0])
 	{
 		++linesRead;
@@ -228,12 +228,12 @@ static long unsigned int updatePseudoTags (MIO *const mio)
 			}
 			mio_getpos (mio, &startOfLine);
 		}
-		line = readLine (TagFile.vLine, mio);
+		line = readLineRaw (TagFile.vLine, mio);
 	}
 	while (line != NULL)                        /* skip to end of file */
 	{
 		++linesRead;
-		line = readLine (TagFile.vLine, mio);
+		line = readLineRaw (TagFile.vLine, mio);
 	}
 	return linesRead;
 }
@@ -253,7 +253,7 @@ static boolean isTagFile (const char *const filename)
 		ok = TRUE;
 	else if (mio != NULL)
 	{
-		const char *line = readLine (TagFile.vLine, mio);
+		const char *line = readLineRaw (TagFile.vLine, mio);
 
 		if (line == NULL)
 			ok = TRUE;


Modified: ctags/main/lregex.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -402,7 +402,7 @@ static void processLanguageRegex (const langType language,
 		else
 		{
 			vString* const regex = vStringNew ();
-			while (readLine (regex, mio))
+			while (readLineRaw (regex, mio))
 				addLanguageRegex (language, vStringValue (regex));
 			mio_free (mio);
 			vStringDelete (regex);


Modified: ctags/main/parse.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -170,7 +170,7 @@ static langType getInterpreterLanguage (const char *const fileName)
 	if (fp != NULL)
 	{
 		vString* const vLine = vStringNew ();
-		const char* const line = readLine (vLine, fp);
+		const char* const line = readLineRaw (vLine, fp);
 		if (line != NULL  &&  line [0] == '#'  &&  line [1] == '!')
 		{
 			const char* const lastSlash = strrchr (line, '/');


Modified: ctags/main/read.c
21 lines changed, 10 insertions(+), 11 deletions(-)
===================================================================
@@ -532,17 +532,16 @@ extern const unsigned char *readLineFromInputFile (void)
 	return result;
 }
 
-
 /*
- *   Source file line reading with automatic buffer sizing
+ *   Raw file line reading with automatic buffer sizing
  */
-extern char *readLine (vString *const vLine, MIO *const mio)
+extern char *readLineRaw (vString *const vLine, MIO *const fp)
 {
 	char *result = NULL;
 
 	vStringClear (vLine);
-	if (mio == NULL)            /* to free memory allocated to buffer */
-		error (FATAL, "NULL MIO pointer");
+	if (fp == NULL)  /* to free memory allocated to buffer */
+		error (FATAL, "NULL file pointer");
 	else
 	{
 		boolean reReadLine;
@@ -555,15 +554,15 @@ extern char *readLine (vString *const vLine, MIO *const mio)
 		do
 		{
 			char *const pLastChar = vStringValue (vLine) + vStringSize (vLine) -2;
-			MIOPos startOfLine;
+			long startOfLine;
 
-			mio_getpos (mio, &startOfLine);
+			startOfLine = mio_tell(fp);
 			reReadLine = FALSE;
 			*pLastChar = '\0';
-			result = mio_gets (mio, vStringValue (vLine), (int) vStringSize (vLine));
+			result = mio_gets (fp, vStringValue (vLine), (int) vStringSize (vLine));
 			if (result == NULL)
 			{
-				if (! mio_eof (mio))
+				if (! mio_eof (fp))
 					error (FATAL | PERROR, "Failure on attempt to read file");
 			}
 			else if (*pLastChar != '\0'  &&
@@ -572,7 +571,7 @@ extern char *readLine (vString *const vLine, MIO *const mio)
 				/*  buffer overflow */
 				reReadLine = vStringAutoResize (vLine);
 				if (reReadLine)
-					mio_setpos (mio, &startOfLine);
+					mio_seek (fp, startOfLine, SEEK_SET);
 				else
 					error (FATAL | PERROR, "input line too big; out of memory");
 			}
@@ -609,7 +608,7 @@ extern char *readSourceLine (vString *const vLine, MIOPos location,
 	mio_setpos (File.fp, &location);
 	if (pSeekValue != NULL)
 		*pSeekValue = mio_tell (File.fp);
-	result = readLine (vLine, File.fp);
+	result = readLineRaw (vLine, File.fp);
 	if (result == NULL)
 		error (FATAL, "Unexpected end of file: %s", getInputFileName ());
 	mio_setpos (File.fp, &orignalPosition);


Modified: ctags/main/read.h
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -111,7 +111,7 @@ extern int getNthPrevCFromInputFile (unsigned int nth, int def);
 extern int skipToCharacterInInputFile (int c);
 extern void ungetcToInputFile (int c);
 extern const unsigned char *readLineFromInputFile (void);
-extern char *readLine (vString *const vLine, MIO *const mio);
+extern char *readLineRaw (vString *const vLine, MIO *const fp);
 extern char *readSourceLine (vString *const vLine, MIOPos location, long *const pSeekValue);
 extern boolean bufferOpen (unsigned char *buffer, size_t buffer_size,
                            const char *const fileName, const langType language );


Modified: ctags/main/sort.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -178,7 +178,7 @@ extern void internalSortTags (const boolean toStdout)
 		failedSort (mio, NULL);
 	for (i = 0  ;  i < numTags  &&  ! mio_eof (mio)  ;  )
 	{
-		line = readLine (vLine, mio);
+		line = readLineRaw (vLine, mio);
 		if (line == NULL)
 		{
 			if (! mio_eof (mio))


Modified: ctags/main/strlist.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -97,7 +97,7 @@ extern stringList* stringListNewFromFile (const char* const fileName)
 		while (! mio_eof (mio))
 		{
 			vString* const str = vStringNew ();
-			readLine (str, mio);
+			readLineRaw (str, mio);
 			vStringStripTrailing (str);
 			if (vStringLength (str) > 0)
 				stringListAdd (result, str);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list