From 40396a392e5239ed79aad79ad1b1f1239670cbe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Techet?= Date: Sun, 2 Oct 2016 00:35:50 +0200 Subject: [PATCH] ctags: drop vStringTerminate() It's call is unnecesssary. Corresponds to universal-ctags commit cfc45e3bd9000e8ce193399c7e0ecf2bbeb57977. --- HACKING | 1 - ctags/main/args.c | 2 -- ctags/main/lcpp.c | 1 - ctags/main/lregex.c | 1 - ctags/main/options.c | 1 - ctags/main/parse.c | 1 - ctags/main/read.c | 1 - ctags/main/routines.c | 3 --- ctags/main/vstring.c | 3 +-- ctags/main/vstring.h | 1 - ctags/parsers/abaqus.c | 1 - ctags/parsers/abc.c | 3 --- ctags/parsers/asciidoc.c | 2 -- ctags/parsers/asm.c | 4 ---- ctags/parsers/basic.c | 3 --- ctags/parsers/c.c | 5 ----- ctags/parsers/conf.c | 3 --- ctags/parsers/css.c | 2 -- ctags/parsers/diff.c | 1 - ctags/parsers/docbook.c | 1 - ctags/parsers/erlang.c | 1 - ctags/parsers/fortran.c | 11 ----------- ctags/parsers/go.c | 2 -- ctags/parsers/haskell.c | 1 - ctags/parsers/haxe.c | 6 ------ ctags/parsers/jscript.c | 8 -------- ctags/parsers/json.c | 3 --- ctags/parsers/latex.c | 3 --- ctags/parsers/lua.c | 1 - ctags/parsers/make.c | 2 -- ctags/parsers/markdown.c | 2 -- ctags/parsers/matlab.c | 2 -- ctags/parsers/nsis.c | 3 --- ctags/parsers/objc.c | 4 ---- ctags/parsers/perl.c | 1 - ctags/parsers/php.c | 9 --------- ctags/parsers/powershell.c | 6 ------ ctags/parsers/python.c | 4 ---- ctags/parsers/r.c | 2 -- ctags/parsers/rest.c | 1 - ctags/parsers/ruby.c | 2 -- ctags/parsers/sh.c | 1 - ctags/parsers/sql.c | 4 ---- ctags/parsers/tcl.c | 1 - ctags/parsers/txt2tags.c | 1 - ctags/parsers/verilog.c | 1 - ctags/parsers/vhdl.c | 1 - 47 files changed, 1 insertion(+), 122 deletions(-) diff --git a/HACKING b/HACKING index 2ac8e5d4..938688d9 100644 --- a/HACKING +++ b/HACKING @@ -460,7 +460,6 @@ Bugs to watch out for * Inserting fields into structs in the plugin API instead of appending. * Not breaking the plugin ABI when necessary. * Using an idle callback that doesn't check main_status.quitting. -* Forgetting to call vStringTerminate in CTags code. * Forgetting CRLF line endings on Windows. * Not handling Tabs & Spaces indent mode. diff --git a/ctags/main/args.c b/ctags/main/args.c index 68808b37..4dc43527 100644 --- a/ctags/main/args.c +++ b/ctags/main/args.c @@ -102,7 +102,6 @@ static char* nextFileArg (FILE* const fp) vStringPut (vs, c); c = fgetc (fp); } while (c != EOF && ! isspace (c)); - vStringTerminate (vs); Assert (vStringLength (vs) > 0); result = xMalloc (vStringLength (vs) + 1, char); strcpy (result, vStringValue (vs)); @@ -127,7 +126,6 @@ static char* nextFileLine (FILE* const fp) vStringPut (vs, c); c = fgetc (fp); } - vStringTerminate (vs); if (vStringLength (vs) > 0) { result = xMalloc (vStringLength (vs) + 1, char); diff --git a/ctags/main/lcpp.c b/ctags/main/lcpp.c index ddd16d38..16a71c00 100644 --- a/ctags/main/lcpp.c +++ b/ctags/main/lcpp.c @@ -212,7 +212,6 @@ static void readIdentifier (int c, vString *const name) c = getcFromInputFile (); } while (c != EOF && cppIsident (c)); ungetcToInputFile (c); - vStringTerminate (name); } static conditionalInfo *currentConditional (void) diff --git a/ctags/main/lregex.c b/ctags/main/lregex.c index 378c2e59..02d63322 100644 --- a/ctags/main/lregex.c +++ b/ctags/main/lregex.c @@ -431,7 +431,6 @@ static vString* substitute ( else if (*p != '\n' && *p != '\r') vStringPut (result, *p); } - vStringTerminate (result); return result; } diff --git a/ctags/main/options.c b/ctags/main/options.c index 962551dd..1f4ded66 100644 --- a/ctags/main/options.c +++ b/ctags/main/options.c @@ -162,7 +162,6 @@ extern bool isIgnoreToken (const char *const name, size_t tokenLen; vStringCopyS (token, c_tags_ignore[i]); - vStringTerminate (token); tokenLen = vStringLength (token); if (tokenLen >= 2 && vStringChar (token, tokenLen - 1) == '*' && diff --git a/ctags/main/parse.c b/ctags/main/parse.c index 4b63a465..69a44a9f 100644 --- a/ctags/main/parse.c +++ b/ctags/main/parse.c @@ -165,7 +165,6 @@ static vString* determineInterpreter (const char* const cmd) ; /* no-op */ for ( ; *p != '\0' && ! isspace (*p) ; ++p) vStringPut (interpreter, (int) *p); - vStringTerminate (interpreter); } while (strcmp (vStringValue (interpreter), "env") == 0); return interpreter; } diff --git a/ctags/main/read.c b/ctags/main/read.c index 61648856..45c1aec8 100644 --- a/ctags/main/read.c +++ b/ctags/main/read.c @@ -444,7 +444,6 @@ static vString *iFileGetLine (void) vStringPut (File.line, c); if (c == '\n' || (c == EOF && vStringLength (File.line) > 0)) { - vStringTerminate (File.line); #ifdef HAVE_REGEX if (vStringLength (File.line) > 0) matchRegex (File.line, File.source.language); diff --git a/ctags/main/routines.c b/ctags/main/routines.c index 7eb0b7cc..5ffdc256 100644 --- a/ctags/main/routines.c +++ b/ctags/main/routines.c @@ -439,10 +439,7 @@ extern vString *combinePathAndFile (const char *const path, vStringCopyS (filePath, path); if (! terminated) - { vStringPut (filePath, OUTPUT_PATH_SEPARATOR); - vStringTerminate (filePath); - } vStringCatS (filePath, file); return filePath; diff --git a/ctags/main/vstring.c b/ctags/main/vstring.c index a40fc9e5..3e440320 100644 --- a/ctags/main/vstring.c +++ b/ctags/main/vstring.c @@ -58,7 +58,7 @@ extern void vStringTruncate (vString *const string, const size_t length) { Assert (length <= string->length); string->length = length; - vStringTerminate (string); + vStringPut(string, '\0'); DebugStatement ( memset (string->buffer + string->length, 0, string->size - string->length); ) } @@ -145,7 +145,6 @@ extern void vStringNCatS ( --remain; ++p; } - vStringTerminate (string); } /* Strip trailing newline from string. diff --git a/ctags/main/vstring.h b/ctags/main/vstring.h index 6da7681a..2724eccc 100644 --- a/ctags/main/vstring.h +++ b/ctags/main/vstring.h @@ -41,7 +41,6 @@ #define vStringCopy(vs,s) vStringCopyS((vs), vStringValue((s))) #define vStringNCopy(vs,s,l) vStringNCopyS((vs), vStringValue((s)), (l)) #define vStringChar(vs,i) ((vs)->buffer[i]) -#define vStringTerminate(vs) vStringPut(vs, '\0') #define vStringLower(vs) toLowerString((vs)->buffer) #define vStringUpper(vs) toUpperString((vs)->buffer) diff --git a/ctags/parsers/abaqus.c b/ctags/parsers/abaqus.c index 992c617b..660f2d9b 100644 --- a/ctags/parsers/abaqus.c +++ b/ctags/parsers/abaqus.c @@ -71,7 +71,6 @@ static void createTag(AbaqusKind kind, const char *buf) vStringPut(name, (int) *buf); ++buf; } while ((*buf != '\0') && (*buf != ',')); - vStringTerminate(name); makeSimpleTag(name, AbaqusKinds, kind); vStringDelete(name); } diff --git a/ctags/parsers/abc.c b/ctags/parsers/abc.c index b86170f9..068b8f6a 100644 --- a/ctags/parsers/abc.c +++ b/ctags/parsers/abc.c @@ -90,21 +90,18 @@ static void findAbcTags (void) /* if (line[1] == '%') { vStringClear(name); vStringCatS(name, (const char *) line); - vStringTerminate(name); makeAbcTag(name, false); }*/ if (line[0] == 'T') { /*vStringClear(name);*/ vStringCatS(name, " / "); vStringCatS(name, (const char *) line); - vStringTerminate(name); makeAbcTag(name, false); } else { vStringClear (name); if (! isspace(*line)) vStringCatS(name, (const char*) line); - vStringTerminate(name); } } vStringDelete (name); diff --git a/ctags/parsers/asciidoc.c b/ctags/parsers/asciidoc.c index 385840f9..42dc0208 100644 --- a/ctags/parsers/asciidoc.c +++ b/ctags/parsers/asciidoc.c @@ -202,7 +202,6 @@ static void findAsciidocTags(void) while (isspace(line[end]))--end; vStringClear(name); vStringNCatS(name, (const char*)(&(line[start])), end - start + 1); - vStringTerminate(name); makeAsciidocTag(name, kind); continue; } @@ -210,7 +209,6 @@ static void findAsciidocTags(void) vStringClear(name); if (! isspace(*line)) vStringCatS(name, (const char*) line); - vStringTerminate(name); } vStringDelete(name); nestingLevelsFree(nestingLevels); diff --git a/ctags/parsers/asm.c b/ctags/parsers/asm.c index 50e0f67b..8003a238 100644 --- a/ctags/parsers/asm.c +++ b/ctags/parsers/asm.c @@ -141,7 +141,6 @@ static bool readPreProc (const unsigned char *const line) vStringPut (name, *cp); ++cp; } - vStringTerminate (name); result = (bool) (strcmp (vStringValue (name), "define") == 0); if (result) { @@ -153,7 +152,6 @@ static bool readPreProc (const unsigned char *const line) vStringPut (name, *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, AsmKinds, K_DEFINE); } vStringDelete (name); @@ -232,7 +230,6 @@ static const unsigned char *readSymbol ( vStringPut (sym, *cp); ++cp; } - vStringTerminate (sym); } return cp; } @@ -248,7 +245,6 @@ static const unsigned char *readOperator ( vStringPut (operator, *cp); ++cp; } - vStringTerminate (operator); return cp; } diff --git a/ctags/parsers/basic.c b/ctags/parsers/basic.c index ff7827bf..e0232ccf 100644 --- a/ctags/parsers/basic.c +++ b/ctags/parsers/basic.c @@ -119,7 +119,6 @@ static int extract_dim (char const *pos, vString * name, BasicKind kind) for (; *pos && !isspace (*pos) && *pos != '(' && *pos != ',' && *pos != '='; pos++) vStringPut (name, *pos); - vStringTerminate (name); makeSimpleTag (name, BasicKinds, kind); /* if the line contains a ',', we have multiple declarations */ @@ -141,7 +140,6 @@ static int extract_dim (char const *pos, vString * name, BasicKind kind) vStringClear (name); for (; *pos && !isspace (*pos) && *pos != '(' && *pos != ',' && *pos != '='; pos++) vStringPut (name, *pos); - vStringTerminate (name); makeSimpleTag (name, BasicKinds, kind); } @@ -157,7 +155,6 @@ static char const *extract_name (char const *pos, vString * name) vStringClear (name); for (; *pos && !isspace (*pos) && *pos != '(' && *pos != ',' && *pos != '='; pos++) vStringPut (name, *pos); - vStringTerminate (name); return pos; } diff --git a/ctags/parsers/c.c b/ctags/parsers/c.c index b20856ce..7035cc1b 100644 --- a/ctags/parsers/c.c +++ b/ctags/parsers/c.c @@ -1330,7 +1330,6 @@ static const char *getVarType (const statementInfo *const st, vStringPut(vt, ' '); vStringCat(vt, t->name); } - vStringTerminate(vt); return vStringValue(vt); } @@ -1786,7 +1785,6 @@ static void readIdentifier (tokenInfo *const token, const int firstChar) vStringPut (name, c); c = cppGetc (); } while (cppIsident (c) || (isInputLanguage (Lang_vala) && '.' == c)); - vStringTerminate (name); cppUngetc (c); /* unget non-identifier character */ /* Vala supports '?' at end of a type (with or without whitespace before) for nullable types */ @@ -1814,7 +1812,6 @@ static void readPackageName (tokenInfo *const token, const int firstChar) vStringPut (name, c); c = cppGetc (); } - vStringTerminate (name); cppUngetc (c); /* unget non-package character */ } @@ -1913,7 +1910,6 @@ static void readOperator (statementInfo *const st) } c = cppGetc (); } while (! isOneOf (c, "(;") && c != EOF); - vStringTerminate (name); } else if (isOneOf (c, acceptable)) { @@ -1923,7 +1919,6 @@ static void readOperator (statementInfo *const st) vStringPut (name, c); c = cppGetc (); } while (isOneOf (c, acceptable)); - vStringTerminate (name); } cppUngetc (c); diff --git a/ctags/parsers/conf.c b/ctags/parsers/conf.c index 0f5bd492..5b6c1e17 100644 --- a/ctags/parsers/conf.c +++ b/ctags/parsers/conf.c @@ -66,11 +66,9 @@ static void findConfTags (void) vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, ConfKinds, K_SECTION); /* remember section name */ vStringCopy (scope, name); - vStringTerminate (scope); vStringClear (name); continue; } @@ -85,7 +83,6 @@ static void findConfTags (void) vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); vStringStripTrailing (name); while (isspace ((int) *cp)) ++cp; diff --git a/ctags/parsers/css.c b/ctags/parsers/css.c index b8bc0126..e3cbb2ed 100644 --- a/ctags/parsers/css.c +++ b/ctags/parsers/css.c @@ -63,7 +63,6 @@ static void parseSelector (vString *const string, const int firstChar) c = getcFromInputFile (); } while (isSelectorChar (c)); ungetcToInputFile (c); - vStringTerminate (string); } static void readToken (tokenInfo *const token) @@ -224,7 +223,6 @@ static void findCssTags (void) /* we already consumed the next token, don't read it twice */ readNextToken = false; - vStringTerminate (selector); if (CssKinds[kind].enabled) { tagEntryInfo e; diff --git a/ctags/parsers/diff.c b/ctags/parsers/diff.c index b37bbddb..892bbdf9 100644 --- a/ctags/parsers/diff.c +++ b/ctags/parsers/diff.c @@ -109,7 +109,6 @@ static void findDiffTags (void) tmp++; } - vStringTerminate(filename); makeSimpleTag (filename, DiffKinds, K_FUNCTION); vStringClear (filename); } diff --git a/ctags/parsers/docbook.c b/ctags/parsers/docbook.c index c4e64558..e9e79027 100644 --- a/ctags/parsers/docbook.c +++ b/ctags/parsers/docbook.c @@ -77,7 +77,6 @@ static void createTag(docbookKind kind, const char *buf) vStringPut(name, (int) *buf); ++buf; } while ((*buf != '\0') && (*buf != '"')); - vStringTerminate(name); makeSimpleTag(name, DocBookKinds, kind); } diff --git a/ctags/parsers/erlang.c b/ctags/parsers/erlang.c index 5d234985..a39edab5 100644 --- a/ctags/parsers/erlang.c +++ b/ctags/parsers/erlang.c @@ -69,7 +69,6 @@ static const unsigned char *parseIdentifier ( vStringPut (identifier, (int) *cp); ++cp; } - vStringTerminate (identifier); return cp; } diff --git a/ctags/parsers/fortran.c b/ctags/parsers/fortran.c index 650e9322..9bf10f46 100644 --- a/ctags/parsers/fortran.c +++ b/ctags/parsers/fortran.c @@ -601,10 +601,7 @@ static lineType getLineType (void) Assert (type != LTYPE_UNDETERMINED); if (vStringLength (label) > 0) - { - vStringTerminate (label); makeLabelTag (label); - } vStringDelete (label); return type; } @@ -796,7 +793,6 @@ static vString *parseInteger (int c) vStringPut (string, c); c = getChar (); } - vStringTerminate (string); if (c == '_') { @@ -835,8 +831,6 @@ static vString *parseNumeric (int c) else ungetChar (c); - vStringTerminate (string); - return string; } @@ -860,7 +854,6 @@ static void parseString (vString *const string, const int delimiter) else if (! FreeSourceForm) longjmp (Exception, (int) ExceptionFixedFormat); } - vStringTerminate (string); ParsingString = false; } @@ -876,7 +869,6 @@ static void parseIdentifier (vString *const string, const int firstChar) c = getChar (); } while (isident (c)); - vStringTerminate (string); ungetChar (c); /* unget non-identifier character */ } @@ -902,7 +894,6 @@ static void checkForLabel (void) } if (length > 0 && token != NULL) { - vStringTerminate (token->string); makeFortranTag (token, TAG_LABEL); deleteToken (token); } @@ -994,7 +985,6 @@ getNextChar: c = getChar (); } while (strchr (operatorChars, c) != NULL); ungetChar (c); - vStringTerminate (token->string); token->type = TOKEN_OPERATOR; break; } @@ -1024,7 +1014,6 @@ getNextChar: if (c == '.') { vStringPut (token->string, c); - vStringTerminate (token->string); token->type = TOKEN_OPERATOR; } else diff --git a/ctags/parsers/go.c b/ctags/parsers/go.c index 0b06d5de..2b56e54c 100644 --- a/ctags/parsers/go.c +++ b/ctags/parsers/go.c @@ -191,7 +191,6 @@ static void parseString (vString *const string, const int delimiter) else vStringPut (string, c); } - vStringTerminate (string); } static void parseIdentifier (vString *const string, const int firstChar) @@ -202,7 +201,6 @@ static void parseIdentifier (vString *const string, const int firstChar) vStringPut (string, c); c = getcFromInputFile (); } while (isIdentChar (c)); - vStringTerminate (string); ungetcToInputFile (c); /* always unget, LF might add a semicolon */ } diff --git a/ctags/parsers/haskell.c b/ctags/parsers/haskell.c index 00fd8eac..e73a4ef4 100644 --- a/ctags/parsers/haskell.c +++ b/ctags/parsers/haskell.c @@ -104,7 +104,6 @@ static void add_tag(const char *token, haskellKind kind, vString *name) for (i = 0; token[i] != '\0'; ++i) vStringPut(name, token[i]); - vStringTerminate(name); makeSimpleTag(name, HaskellKinds, kind); vStringClear(name); } diff --git a/ctags/parsers/haxe.c b/ctags/parsers/haxe.c index c9100c89..762c80d1 100644 --- a/ctags/parsers/haxe.c +++ b/ctags/parsers/haxe.c @@ -90,7 +90,6 @@ another: vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, HxKinds, HXTAG_VARIABLE); vStringClear (name); @@ -109,7 +108,6 @@ another: vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, HxKinds, HXTAG_METHODS); vStringClear (name); @@ -127,7 +125,6 @@ another: vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, HxKinds, HXTAG_CLASS); vStringCopy(clsName,name); vStringClear (name); @@ -145,7 +142,6 @@ another: vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, HxKinds, HXTAG_ENUM); vStringClear (name); } else if (strncmp ((const char*) cp, "public", (size_t) 6) == 0 && @@ -175,7 +171,6 @@ another: vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, HxKinds, HXTAG_INTERFACE); vStringClear (name); } else if (strncmp ((const char *) cp,"typedef",(size_t) 7) == 0 && isspace(((int) cp[7]))) { @@ -188,7 +183,6 @@ another: vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, HxKinds, HXTAG_TYPEDEF); vStringClear (name); } diff --git a/ctags/parsers/jscript.c b/ctags/parsers/jscript.c index c116d845..0305e5b6 100644 --- a/ctags/parsers/jscript.c +++ b/ctags/parsers/jscript.c @@ -282,7 +282,6 @@ static void makeClassTag (tokenInfo *const token, vString *const signature) { vStringCopy(fulltag, token->string); } - vStringTerminate(fulltag); if ( ! stringListHas(ClassNames, vStringValue (fulltag)) ) { stringListAdd (ClassNames, vStringNewCopy (fulltag)); @@ -309,7 +308,6 @@ static void makeFunctionTag (tokenInfo *const token, vString *const signature) { vStringCopy(fulltag, token->string); } - vStringTerminate(fulltag); if ( ! stringListHas(FunctionNames, vStringValue (fulltag)) ) { stringListAdd (FunctionNames, vStringNewCopy (fulltag)); @@ -362,7 +360,6 @@ static void parseString (vString *const string, const int delimiter) else vStringPut (string, c); } - vStringTerminate (string); } static void parseRegExp (void) @@ -403,7 +400,6 @@ static void parseIdentifier (vString *const string, const int firstChar) vStringPut (string, c); c = getcFromInputFile (); } while (isIdentChar (c)); - vStringTerminate (string); ungetcToInputFile (c); /* unget non-identifier character */ } @@ -708,7 +704,6 @@ static void addContext (tokenInfo* const parent, const tokenInfo* const child) vStringCatS (parent->string, "."); } vStringCatS (parent->string, vStringValue(child->string)); - vStringTerminate(parent->string); } static void addToScope (tokenInfo* const token, vString* const extra) @@ -718,7 +713,6 @@ static void addToScope (tokenInfo* const token, vString* const extra) vStringCatS (token->scope, "."); } vStringCatS (token->scope, vStringValue(extra)); - vStringTerminate(token->scope); } /* @@ -1600,7 +1594,6 @@ static bool parseStatement (tokenInfo *const token, tokenInfo *const parent, boo { vStringCopy(fulltag, token->string); } - vStringTerminate(fulltag); if ( ! stringListHas(FunctionNames, vStringValue (fulltag)) && ! stringListHas(ClassNames, vStringValue (fulltag)) ) { @@ -1691,7 +1684,6 @@ static bool parseStatement (tokenInfo *const token, tokenInfo *const parent, boo { vStringCopy(fulltag, token->string); } - vStringTerminate(fulltag); if ( ! stringListHas(FunctionNames, vStringValue (fulltag)) && ! stringListHas(ClassNames, vStringValue (fulltag)) ) { diff --git a/ctags/parsers/json.c b/ctags/parsers/json.c index e33aac2e..8965eefb 100644 --- a/ctags/parsers/json.c +++ b/ctags/parsers/json.c @@ -181,7 +181,6 @@ static void readTokenFull (tokenInfo *const token, if (includeStringRepr) vStringPut (token->string, c); } - vStringTerminate (token->string); break; } @@ -196,7 +195,6 @@ static void readTokenFull (tokenInfo *const token, c = getcFromInputFile (); } while (c != EOF && isIdentChar (c)); - vStringTerminate (token->string); ungetcToInputFile (c); switch (lookupKeyword (vStringValue (token->string), Lang_json)) { @@ -219,7 +217,6 @@ static void pushScope (tokenInfo *const token, if (vStringLength (token->scope) > 0) vStringPut (token->scope, '.'); vStringCat (token->scope, parent->string); - vStringTerminate (token->scope); token->scopeKind = parentKind; } diff --git a/ctags/parsers/latex.c b/ctags/parsers/latex.c index f68db089..b25317c4 100644 --- a/ctags/parsers/latex.c +++ b/ctags/parsers/latex.c @@ -105,7 +105,6 @@ static void createTag(int flags, TeXKind kind, const char * l) vStringPut(name, (int) *l); ++l; } while ((*l != '\0') && (*l != '}')); - vStringTerminate(name); if (name->buffer[0] != '}') makeSimpleTag(name, TeXKinds, kind); } @@ -116,13 +115,11 @@ static void createTag(int flags, TeXKind kind, const char * l) vStringPut (name, (int) *l); ++l; } while (isalpha((int) *l) || *l == '@'); - vStringTerminate(name); makeSimpleTag(name, TeXKinds, kind); } else { vStringPut(name, (int) *l); - vStringTerminate(name); makeSimpleTag(name, TeXKinds, kind); } diff --git a/ctags/parsers/lua.c b/ctags/parsers/lua.c index 67524a4e..86e80d68 100644 --- a/ctags/parsers/lua.c +++ b/ctags/parsers/lua.c @@ -79,7 +79,6 @@ static void extract_name (const char *begin, const char *end, vString *name) { for (cp = begin ; cp != end; cp++) vStringPut (name, (int) *cp); - vStringTerminate (name); makeSimpleTag (name, LuaKinds, K_FUNCTION); vStringClear (name); diff --git a/ctags/parsers/make.c b/ctags/parsers/make.c index f73a0b95..9898b995 100644 --- a/ctags/parsers/make.c +++ b/ctags/parsers/make.c @@ -120,7 +120,6 @@ static void readIdentifier (const int first, vString *const id) c = nextChar (); } ungetcToInputFile (c); - vStringTerminate (id); } static void findMakeTags (void) @@ -208,7 +207,6 @@ static void findMakeTags (void) } if (c == '\n') ungetcToInputFile (c); - vStringTerminate (name); vStringStripTrailing (name); newMacro (name); } diff --git a/ctags/parsers/markdown.c b/ctags/parsers/markdown.c index 1bad8c9b..629925c4 100644 --- a/ctags/parsers/markdown.c +++ b/ctags/parsers/markdown.c @@ -75,14 +75,12 @@ static void findMarkdownTags (void) else if (line[0] == '#') { vStringClear(name); vStringCatS(name, (const char *) line); - vStringTerminate(name); makeMarkdownTag(name, false); } else { vStringClear (name); if (! isspace(*line)) vStringCatS(name, (const char*) line); - vStringTerminate(name); } } vStringDelete (name); diff --git a/ctags/parsers/matlab.c b/ctags/parsers/matlab.c index 528e5ac0..a51fb147 100644 --- a/ctags/parsers/matlab.c +++ b/ctags/parsers/matlab.c @@ -107,7 +107,6 @@ static void findMatlabTags (void) } } - vStringTerminate (name); makeSimpleTag (name, MatlabKinds, K_FUNCTION); vStringClear (name); } @@ -129,7 +128,6 @@ static void findMatlabTags (void) ++cp; } - vStringTerminate (name); makeSimpleTag (name, MatlabKinds, K_STRUCT); vStringClear (name); } diff --git a/ctags/parsers/nsis.c b/ctags/parsers/nsis.c index 56a0a37b..ba5c51c0 100644 --- a/ctags/parsers/nsis.c +++ b/ctags/parsers/nsis.c @@ -68,7 +68,6 @@ static void findNsisTags (void) vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, NsisKinds, K_FUNCTION); vStringClear (name); } @@ -94,7 +93,6 @@ static void findNsisTags (void) vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, NsisKinds, K_VARIABLE); vStringClear (name); } @@ -124,7 +122,6 @@ static void findNsisTags (void) vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, NsisKinds, K_SECTION); vStringClear (name); } diff --git a/ctags/parsers/objc.c b/ctags/parsers/objc.c index dccecd14..6ceac0f8 100644 --- a/ctags/parsers/objc.c +++ b/ctags/parsers/objc.c @@ -245,8 +245,6 @@ static void readIdentifier (lexingState * st) vStringPut (st->name, (int) *p); st->cp = p; - - vStringTerminate (st->name); } /* read the @something directives */ @@ -264,8 +262,6 @@ static void readIdentifierObjcDirective (lexingState * st) vStringPut (st->name, (int) *p); st->cp = p; - - vStringTerminate (st->name); } /* The lexer is in charge of reading the file. diff --git a/ctags/parsers/perl.c b/ctags/parsers/perl.c index 374215c6..844fcea9 100644 --- a/ctags/parsers/perl.c +++ b/ctags/parsers/perl.c @@ -304,7 +304,6 @@ static void findPerlTags (void) vStringCatS (name, "STDOUT"); } - vStringTerminate (name); TRACE("name: %s\n", name->buffer); if (0 == vStringLength(name)) { diff --git a/ctags/parsers/php.c b/ctags/parsers/php.c index 12f125bd..b29ed4fe 100644 --- a/ctags/parsers/php.c +++ b/ctags/parsers/php.c @@ -298,7 +298,6 @@ static void initPhpEntry (tagEntryInfo *const e, const tokenInfo *const token, { Assert (parentKind >= 0); - vStringTerminate (fullScope); e->extensionFields.scopeKind = &(PhpKinds[parentKind]); e->extensionFields.scopeName = vStringValue (fullScope); } @@ -475,7 +474,6 @@ static void addToScope (tokenInfo *const token, const vString *const extra) if (vStringLength (token->scope) > 0) vStringCatS (token->scope, SCOPE_SEPARATOR); vStringCatS (token->scope, vStringValue (extra)); - vStringTerminate(token->scope); } static bool isIdentChar (const int c) @@ -496,7 +494,6 @@ static void parseString (vString *const string, const int delimiter) else vStringPut (string, (char) c); } - vStringTerminate (string); } /* reads an HereDoc or a NowDoc (the part after the <<<). @@ -614,8 +611,6 @@ static void parseHeredoc (vString *const string) } while (c != EOF); - vStringTerminate (string); - return; error: @@ -631,7 +626,6 @@ static void parseIdentifier (vString *const string, const int firstChar) c = getcFromInputFile (); } while (isIdentChar (c)); ungetcToInputFile (c); - vStringTerminate (string); } static keywordId analyzeToken (vString *const name, langType language) @@ -1144,8 +1138,6 @@ static bool parseFunction (tokenInfo *const token, const tokenInfo *name) } while (token->type != TOKEN_EOF && depth > 0); - vStringTerminate (arglist); - makeFunctionTag (name, arglist, access, impl); vStringDelete (arglist); @@ -1340,7 +1332,6 @@ static bool parseNamespace (tokenInfo *const token) token->type != TOKEN_SEMICOLON && token->type != TOKEN_OPEN_CURLY); - vStringTerminate (CurrentNamespace); if (vStringLength (CurrentNamespace) > 0) makeNamespacePhpTag (nsToken, CurrentNamespace); diff --git a/ctags/parsers/powershell.c b/ctags/parsers/powershell.c index 7a9cd331..32623a6c 100644 --- a/ctags/parsers/powershell.c +++ b/ctags/parsers/powershell.c @@ -180,7 +180,6 @@ static void addToScope (tokenInfo *const token, const vString *const extra) if (vStringLength (token->scope) > 0) vStringCatS (token->scope, SCOPE_SEPARATOR); vStringCatS (token->scope, vStringValue (extra)); - vStringTerminate (token->scope); } static bool isIdentChar (const int c) @@ -201,7 +200,6 @@ static void parseString (vString *const string, const int delimiter) else vStringPut (string, (char) c); } - vStringTerminate (string); } static void parseIdentifier (vString *const string, const int firstChar) @@ -213,7 +211,6 @@ static void parseIdentifier (vString *const string, const int firstChar) c = getcFromInputFile (); } while (isIdentChar (c)); ungetcToInputFile (c); - vStringTerminate (string); } static bool isTokenFunction (vString *const name) @@ -388,7 +385,6 @@ static const char *parsePowerShellScope (tokenInfo *const token) powershellScopeLen = (size_t)(powershellScopeEnd - tokenName); /* extract the scope */ vStringNCopyS (powershellScope, tokenName, powershellScopeLen); - vStringTerminate (powershellScope); /* cut the resulting scope string from the identifier */ memmove (token->string->buffer, /* +1 to skip the leading colon */ @@ -488,8 +484,6 @@ static bool parseFunction (tokenInfo *const token) } while (token->type != TOKEN_EOF && depth > 0); - vStringTerminate (arglist); - makeFunctionTag (nameFree, arglist, access); vStringDelete (arglist); diff --git a/ctags/parsers/python.c b/ctags/parsers/python.c index ee8c43aa..f9770c09 100644 --- a/ctags/parsers/python.c +++ b/ctags/parsers/python.c @@ -286,7 +286,6 @@ static const char *parseIdentifier (const char *cp, vString *const identifier) vStringPut (identifier, (int) *cp); ++cp; } - vStringTerminate (identifier); return cp; } @@ -313,7 +312,6 @@ static void parseClass (const char *cp, vString *const class, vStringPut (inheritance, *cp); ++cp; } - vStringTerminate (inheritance); } makeClassTag (class, inheritance, parent, is_class_parent); vStringDelete (inheritance); @@ -642,7 +640,6 @@ static bool varIsLambda (const char *cp, char **arglist) for (; *cp != 0 && *cp != ':'; cp++) vStringPut (args, *cp); vStringPut (args, ')'); - vStringTerminate (args); if (arglist) *arglist = strdup (vStringValue (args)); vStringDelete (args); @@ -733,7 +730,6 @@ static void findPythonTags (void) vStringPut (name, (int) *start); ++start; } - vStringTerminate (name); parent_is_class = constructParentString(nesting_levels, indent, parent); if (varIsLambda (variable, &arglist)) diff --git a/ctags/parsers/r.c b/ctags/parsers/r.c index 77bed51e..2dd13f77 100644 --- a/ctags/parsers/r.c +++ b/ctags/parsers/r.c @@ -94,7 +94,6 @@ static void createRTags (void) vStringPut(name, (int)*cp); cp++; } - vStringTerminate(name); /* if the string really exists, make a tag of it */ if (vStringLength(name) > 0) @@ -134,7 +133,6 @@ static void createRTags (void) if (strncasecmp((const char*)cp, "function", (size_t)8) == 0) { /* it's a function: ident <- function(args) */ cp += 8; - vStringTerminate(name); /* if the string really exists, make a tag of it */ if (vStringLength(name) > 0) makeRTag(name, K_FUNCTION); diff --git a/ctags/parsers/rest.c b/ctags/parsers/rest.c index 362411b3..ad13c196 100644 --- a/ctags/parsers/rest.c +++ b/ctags/parsers/rest.c @@ -186,7 +186,6 @@ static void findRestTags (void) vStringClear (name); if (! isspace(*line)) vStringCatS(name, (const char*) line); - vStringTerminate(name); } vStringDelete (name); nestingLevelsFree(nestingLevels); diff --git a/ctags/parsers/ruby.c b/ctags/parsers/ruby.c index c930b43c..9ef4153b 100644 --- a/ctags/parsers/ruby.c +++ b/ctags/parsers/ruby.c @@ -189,7 +189,6 @@ static void emitRubyTag (vString* name, rubyKind kind) return; } - vStringTerminate (name); scope = nestingLevelsToScope (nesting); lvl = nestingLevelsGetCurrent (nesting); if (lvl) @@ -311,7 +310,6 @@ static rubyKind parseIdentifier ( /* Recognize singleton methods. */ if (last_char == '.') { - vStringTerminate (name); vStringClear (name); return parseIdentifier (cp, name, K_SINGLETON); } diff --git a/ctags/parsers/sh.c b/ctags/parsers/sh.c index 529896b2..fd371a51 100644 --- a/ctags/parsers/sh.c +++ b/ctags/parsers/sh.c @@ -80,7 +80,6 @@ static void findShTags (void) vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); while (isspace ((int) *cp)) ++cp; if (*cp++ == '(') diff --git a/ctags/parsers/sql.c b/ctags/parsers/sql.c index 8ac8e854..dde34094 100644 --- a/ctags/parsers/sql.c +++ b/ctags/parsers/sql.c @@ -477,7 +477,6 @@ static void parseString (vString *const string, const int delimiter) else vStringPut (string, c); } - vStringTerminate (string); } /* Read a C identifier beginning with "firstChar" and places it into "name". @@ -491,7 +490,6 @@ static void parseIdentifier (vString *const string, const int firstChar) vStringPut (string, c); c = getcFromInputFile (); } while (isIdentChar (c)); - vStringTerminate (string); if (!isspace (c)) ungetcToInputFile (c); /* unget non-identifier character */ } @@ -679,7 +677,6 @@ static void readIdentifier (tokenInfo *const token) * vStringCatS (parent->string, "."); * } * vStringCatS (parent->string, vStringValue(child->string)); - * vStringTerminate(parent->string); * } */ @@ -690,7 +687,6 @@ static void addToScope (tokenInfo* const token, vString* const extra, sqlKind ki vStringCatS (token->scope, "."); } vStringCatS (token->scope, vStringValue(extra)); - vStringTerminate(token->scope); token->scopeKind = kind; } diff --git a/ctags/parsers/tcl.c b/ctags/parsers/tcl.c index a15907e7..2b43b7ba 100644 --- a/ctags/parsers/tcl.c +++ b/ctags/parsers/tcl.c @@ -48,7 +48,6 @@ static const unsigned char *makeTclTag ( vStringPut (name, (int) *cp); ++cp; } - vStringTerminate (name); makeSimpleTag (name, TclKinds, kind); return cp; } diff --git a/ctags/parsers/txt2tags.c b/ctags/parsers/txt2tags.c index 64f7eb6f..05d88362 100644 --- a/ctags/parsers/txt2tags.c +++ b/ctags/parsers/txt2tags.c @@ -169,7 +169,6 @@ static void findTxt2tagsTags (void) nl = nestingLevelsGetCurrent(nls); } - vStringTerminate(name); makeTxt2tagsTag(name, nls, K_SECTION); nestingLevelsPush(nls, name, K_SECTION); nestingLevelsGetCurrent(nls)->indentation = depth; diff --git a/ctags/parsers/verilog.c b/ctags/parsers/verilog.c index aa2c3518..9fd826dc 100644 --- a/ctags/parsers/verilog.c +++ b/ctags/parsers/verilog.c @@ -200,7 +200,6 @@ static bool readIdentifier (vString *const name, int c) c = vGetc (); } vUngetc (c); - vStringTerminate (name); } return (bool)(name->length > 0); } diff --git a/ctags/parsers/vhdl.c b/ctags/parsers/vhdl.c index af194e40..9d26eb86 100644 --- a/ctags/parsers/vhdl.c +++ b/ctags/parsers/vhdl.c @@ -167,7 +167,6 @@ static bool readIdentifier (vString *const name, int c) c = vGetc (); } vUngetc (c); - vStringTerminate (name); } return (bool)(name->length > 0); }