[anjuta] anjuta-tags: remove getInputFilePosition by replacing fpos_t with long
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] anjuta-tags: remove getInputFilePosition by replacing fpos_t with long
- Date: Thu, 14 Mar 2019 17:45:58 +0000 (UTC)
commit 91f5e7fe0a6e4d548f4888711cdaaf7bedab6f85
Author: Konstantin Kharlamov <Hi-Angel yandex ru>
Date: Tue Mar 12 02:20:13 2019 +0300
anjuta-tags: remove getInputFilePosition by replacing fpos_t with long
Signed-off-by: Konstantin Kharlamov <Hi-Angel yandex ru>
plugins/symbol-db/anjuta-tags/read.c | 21 +++++----------------
plugins/symbol-db/anjuta-tags/read.h | 4 ++--
2 files changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/plugins/symbol-db/anjuta-tags/read.c b/plugins/symbol-db/anjuta-tags/read.c
index 99ed02154..d68eff45c 100644
--- a/plugins/symbol-db/anjuta-tags/read.c
+++ b/plugins/symbol-db/anjuta-tags/read.c
@@ -30,7 +30,7 @@
* DATA DEFINITIONS
*/
inputFile File; /* globally read through macros */
-static fpos_t StartOfLine; /* holds deferred position of start of line */
+static long StartOfLine; /* holds deferred position of start of line */
/*
* FUNCTION DEFINITIONS
@@ -268,8 +268,7 @@ extern boolean fileOpen (const char *const fileName, const langType language)
opened = TRUE;
setInputFileName (fileName);
- fgetpos (File.fp, &StartOfLine);
- fgetpos (File.fp, &File.filePosition);
+ File.filePosition = StartOfLine = ftell (File.fp);
File.currentLine = NULL;
File.language = language;
File.lineNumber = 0L;
@@ -343,7 +342,7 @@ readnext:
goto readnext;
else
{
- fsetpos (File.fp, &StartOfLine);
+ fseek (File.fp, StartOfLine, SEEK_SET);
c = getc (File.fp);
}
}
@@ -354,7 +353,7 @@ readnext:
else if (c == NEWLINE)
{
File.newLine = TRUE;
- fgetpos (File.fp, &StartOfLine);
+ StartOfLine = ftell (File.fp);
}
else if (c == CRETURN)
{
@@ -371,7 +370,7 @@ readnext:
{
c = NEWLINE; /* convert CR into newline */
File.newLine = TRUE;
- fgetpos (File.fp, &StartOfLine);
+ StartOfLine = ftell (File.fp);
}
}
DebugStatement ( debugPutc (DEBUG_RAW, c); )
@@ -540,16 +539,6 @@ extern char *readLine (vString *const vLine, FILE *const fp)
return result;
}
-long getInputFilePosition() {
- fpos_t originalPosition;
- long ret;
- fgetpos (File.fp, &originalPosition);
- fsetpos (File.fp, &File.filePosition);
- ret = ftell(File.fp);
- fsetpos (File.fp, &originalPosition);
- return ret;
-}
-
/* Places into the line buffer the contents of the line referenced by
* "location".
*/
diff --git a/plugins/symbol-db/anjuta-tags/read.h b/plugins/symbol-db/anjuta-tags/read.h
index 510dc2bf1..4a1c64099 100644
--- a/plugins/symbol-db/anjuta-tags/read.h
+++ b/plugins/symbol-db/anjuta-tags/read.h
@@ -33,6 +33,7 @@
*/
#define getInputLineNumber() File.lineNumber
#define getInputFileName() vStringValue (File.source.name)
+#define getInputFilePosition() File.filePosition
#define getSourceFileName() vStringValue (File.source.name)
#define getSourceFileTagPath() File.source.tagPath
#define getSourceLanguage() File.source.language
@@ -72,7 +73,7 @@ typedef struct sInputFile {
const unsigned char* currentLine; /* current line being worked on */
FILE *fp; /* stream used for reading the file */
unsigned long lineNumber; /* line number in the input file */
- fpos_t filePosition; /* file position of current line */
+ long filePosition; /* file position of current line */
int ungetch; /* a single character that was ungotten */
boolean eof; /* have we reached the end of file? */
boolean newLine; /* will the next character begin a new line? */
@@ -109,7 +110,6 @@ extern void fileUngetc (int c);
extern const unsigned char *fileReadLine (void);
extern char *readLine (vString *const vLine, FILE *const fp);
extern char *readSourceLine (vString *const vLine, long location);
-extern long getInputFilePosition(void);
#endif /* _READ_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]