summaryrefslogtreecommitdiffstats
path: root/gettext-tools/src/x-librep.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2003-06-16 11:17:55 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:10:41 +0200
commit1299e08182b4248f2ef4441e2731946f32c0ba7f (patch)
treef128c04dd99c8d7a1225b6e497845a58befd8bc5 /gettext-tools/src/x-librep.c
parent1403a591e49c3d8959c55009bf189412f3bb819d (diff)
downloadexternal_gettext-1299e08182b4248f2ef4441e2731946f32c0ba7f.zip
external_gettext-1299e08182b4248f2ef4441e2731946f32c0ba7f.tar.gz
external_gettext-1299e08182b4248f2ef4441e2731946f32c0ba7f.tar.bz2
Avoid quadratic running time when extracting very long strings or very
long comments.
Diffstat (limited to 'gettext-tools/src/x-librep.c')
-rw-r--r--gettext-tools/src/x-librep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gettext-tools/src/x-librep.c b/gettext-tools/src/x-librep.c
index 06cc2bf..3af8beb 100644
--- a/gettext-tools/src/x-librep.c
+++ b/gettext-tools/src/x-librep.c
@@ -1,5 +1,5 @@
/* xgettext librep backend.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003 Free Software Foundation, Inc.
This file was written by Bruno Haible <haible@clisp.cons.org>, 2001.
@@ -420,7 +420,7 @@ comment_add (int c)
{
if (buflen >= bufmax)
{
- bufmax += 100;
+ bufmax = 2 * bufmax + 10;
buffer = xrealloc (buffer, bufmax);
}
buffer[buflen++] = c;
@@ -435,7 +435,7 @@ comment_line_end (size_t chars_to_remove)
--buflen;
if (chars_to_remove == 0 && buflen >= bufmax)
{
- bufmax += 100;
+ bufmax = 2 * bufmax + 10;
buffer = xrealloc (buffer, bufmax);
}
buffer[buflen] = '\0';