Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sun, 14 Jun 2015 16:27:17 UTC
Commit: 882687ec37d41bcd74e07ab13ead45ce2141ecad
https://github.com/geany/geany/commit/882687ec37d41bcd74e07ab13ead45ce2141e…
Log Message:
-----------
C#: Don't ignore the character following an '@'
The character following an '@' was dropped if it didn't start a string
literal.
…
[View More]This could lead to unexpected problems if '@' was valid in other
situations.
X-Universal-CTags-Commit-ID: 2e62f475af1db08850447de46f56db14ce99d2eb
Modified Paths:
--------------
tagmanager/ctags/get.c
Modified: tagmanager/ctags/get.c
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -726,6 +726,8 @@ extern int cppGetc (void)
c = skipToEndOfString (TRUE);
break;
}
+ else
+ fileUngetc (next);
}
enter:
Cpp.directive.accept = FALSE;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
[View Less]
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sun, 14 Jun 2015 15:57:18 UTC
Commit: b975c2652da201c9e84f4b817c18408814364f36
https://github.com/geany/geany/commit/b975c2652da201c9e84f4b817c18408814364…
Log Message:
-----------
read: Allow to unget up to 3 characters
Some parsers need to unget more than one characters, so add support for
this.
X-Universal-…
[View More]CTags-Commit-ID: 956af0555d3a8ef33304c5ae6ed873f22b4e4284
Modified Paths:
--------------
tagmanager/ctags/read.c
tagmanager/ctags/read.h
Modified: tagmanager/ctags/read.c
12 lines changed, 8 insertions(+), 4 deletions(-)
===================================================================
@@ -428,7 +428,12 @@ static int iFileGetc (void)
extern void fileUngetc (int c)
{
- File.ungetch = c;
+ const size_t len = sizeof File.ungetchBuf / sizeof File.ungetchBuf[0];
+
+ Assert (File.ungetchIdx < len);
+ /* we cannot rely on the assertion that might be disabled in non-debug mode */
+ if (File.ungetchIdx < len)
+ File.ungetchBuf[File.ungetchIdx++] = c;
}
static vString *iFileGetLine (void)
@@ -468,10 +473,9 @@ extern int fileGetc (void)
* other processing on it, though, because we already did that the
* first time it was read through fileGetc ().
*/
- if (File.ungetch != '\0')
+ if (File.ungetchIdx > 0)
{
- c = File.ungetch;
- File.ungetch = '\0';
+ c = File.ungetchBuf[--File.ungetchIdx];
return c; /* return here to avoid re-calling debugPutc () */
}
do
Modified: tagmanager/ctags/read.h
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -70,7 +70,8 @@ typedef struct sInputFile {
MIO *mio; /* stream used for reading the file */
unsigned long lineNumber; /* line number in the input file */
MIOPos filePosition; /* file position of current line */
- int ungetch; /* a single character that was ungotten */
+ unsigned int ungetchIdx;
+ int ungetchBuf[3]; /* characters that were ungotten */
boolean eof; /* have we reached the end of file? */
boolean newLine; /* will the next character begin a new line? */
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
[View Less]
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Sun, 14 Jun 2015 15:52:24 UTC
Commit: e26c9ba2ced88d5bcf1804e228918b63cae76b20
https://github.com/geany/geany/commit/e26c9ba2ced88d5bcf1804e228918b63cae76…
Log Message:
-----------
Add linear tag remove path for cases where not many files are open
When tested with 200000 LOC python file (created by making many copies
of scripts/…
[View More]create_py_tags.py), the tm_tags_remove_file_tags() function
takes about 50% of the CPU time when only this file is open. After adding
the linear path to tm_tags_remove_file_tags() it takes just about 2%. See
the comment in the patch for more details.
Modified Paths:
--------------
tagmanager/src/tm_tag.c
Modified: tagmanager/src/tm_tag.c
74 lines changed, 50 insertions(+), 24 deletions(-)
===================================================================
@@ -828,37 +828,63 @@ gboolean tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes,
void tm_tags_remove_file_tags(TMSourceFile *source_file, GPtrArray *tags_array)
{
guint i;
- GPtrArray *to_delete = g_ptr_array_sized_new(source_file->tags_array->len);
-
- for (i = 0; i < source_file->tags_array->len; i++)
+
+ /* Now we choose between an algorithm with complexity O(tags_array->len) and
+ * O(source_file->tags_array->len * log(tags_array->len)). The latter algorithm
+ * is better when tags_array contains many times more tags than
+ * source_file->tags_array so instead of trying to find the removed tags
+ * linearly, binary search is used. The constant 20 is more or less random
+ * but seems to work well. It's exact value isn't so critical because it's
+ * the extremes where the difference is the biggest: when
+ * source_file->tags_array->len == tags_array->len (single file open) and
+ * source_file->tags_array->len << tags_array->len (the number of tags
+ * from the file is a small fraction of all tags).
+ */
+ if (source_file->tags_array->len != 0 &&
+ tags_array->len / source_file->tags_array->len < 20)
{
- guint j;
- guint tag_count;
- TMTag **found;
- TMTag *tag = source_file->tags_array->pdata[i];
-
- found = tm_tags_find(tags_array, tag->name, FALSE, TRUE, &tag_count);
-
- for (j = 0; j < tag_count; j++)
+ for (i = 0; i < tags_array->len; i++)
{
- if (*found != NULL && (*found)->file == source_file)
+ TMTag *tag = tags_array->pdata[i];
+
+ if (tag->file == source_file)
+ tags_array->pdata[i] = NULL;
+ }
+ }
+ else
+ {
+ GPtrArray *to_delete = g_ptr_array_sized_new(source_file->tags_array->len);
+
+ for (i = 0; i < source_file->tags_array->len; i++)
+ {
+ guint j;
+ guint tag_count;
+ TMTag **found;
+ TMTag *tag = source_file->tags_array->pdata[i];
+
+ found = tm_tags_find(tags_array, tag->name, FALSE, TRUE, &tag_count);
+
+ for (j = 0; j < tag_count; j++)
{
- /* we cannot set the pointer to NULL now because the search wouldn't work */
- g_ptr_array_add(to_delete, found);
- /* no break - if there are multiple tags of the same name, we would
- * always find the first instance and wouldn't remove others; duplicates
- * in the to_delete list aren't a problem */
+ if (*found != NULL && (*found)->file == source_file)
+ {
+ /* we cannot set the pointer to NULL now because the search wouldn't work */
+ g_ptr_array_add(to_delete, found);
+ /* no break - if there are multiple tags of the same name, we would
+ * always find the first instance and wouldn't remove others; duplicates
+ * in the to_delete list aren't a problem */
+ }
+ found++;
}
- found++;
}
- }
- for (i = 0; i < to_delete->len; i++)
- {
- TMTag **tag = to_delete->pdata[i];
- *tag = NULL;
+ for (i = 0; i < to_delete->len; i++)
+ {
+ TMTag **tag = to_delete->pdata[i];
+ *tag = NULL;
+ }
+ g_ptr_array_free(to_delete, TRUE);
}
- g_ptr_array_free(to_delete, TRUE);
tm_tags_prune(tags_array);
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
[View Less]