Fix unnecessary 40 character limit for auto-closing XML tags (closes #2007278).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2743 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-07-03 12:32:55 +00:00
parent 70df7f6388
commit d8032f4248
2 changed files with 13 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2008-07-03 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/utils.c:
Fix unnecessary 40 character limit for auto-closing XML tags
(closes #2007278).
2008-07-02 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/keybindings.c:

View File

@ -249,15 +249,12 @@ gint utils_write_file(const gchar *filename, const gchar *text)
*/
gchar *utils_find_open_xml_tag(const gchar sel[], gint size, gboolean check_tag)
{
/* 40 chars per tag should be enough, or not? */
gint i = 0, max_tag_size = 40;
gchar *result = g_malloc(max_tag_size);
GString *result = g_string_sized_new(64);
const gchar *begin, *cur;
if (size < 3)
{
/* Smallest tag is "<p>" which is 3 characters */
return result;
{ /* Smallest tag is "<p>" which is 3 characters */
return NULL;
}
begin = &sel[0];
if (check_tag)
@ -276,16 +273,15 @@ gchar *utils_find_open_xml_tag(const gchar sel[], gint size, gboolean check_tag)
if (*cur == '<')
{
cur++;
while((strchr(":_-.", *cur) || isalnum(*cur)) && i < (max_tag_size - 1))
while((strchr(":_-.", *cur) || isalnum(*cur)))
{
result[i++] = *cur;
g_string_append_c(result, *cur);
cur++;
}
}
result[i] = '\0';
/* Return the tag name or "" */
return result;
return g_string_free(result, FALSE);
}