(etags_set_definition_hash): refactoring:

* type accuracy;
  * reduce variable scope;
  * trivial optimisation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-03-02 10:06:59 +03:00
parent 4bd1008a03
commit a5ebb7d619
1 changed files with 9 additions and 7 deletions

View File

@ -188,7 +188,6 @@ etags_set_definition_hash (const char *tagfile, const char *start_path,
char *chekedstr = NULL;
int num = 0; /* returned value */
int pos;
char *filename = NULL;
if (!match_func || !tagfile)
@ -210,12 +209,15 @@ etags_set_definition_hash (const char *tagfile, const char *start_path,
}
break;
case in_filename:
{
size_t pos;
pos = strcspn (buf, ",");
g_free (filename);
filename = g_malloc (pos + 2);
g_strlcpy (filename, (char *) buf, pos + 1);
filename = g_strndup (buf, pos + 1);
state = in_define;
break;
}
case in_define:
if (buf[0] == 0x0C)
{