[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug
From: |
Bruno Haible |
Subject: |
Re: bug |
Date: |
Thu, 23 Jan 2003 13:07:27 +0100 (CET) |
liu jack wrote:
> Hi! I'm from i18n zh-CN team. When I use the tool msgfmt to process my
> compendium.po which has more than 200,000 lines,it crashes and reports:
> Segmentation fault (core dumped).
Thanks for the report. The appended patch should fix it.
Bruno
*** gettext-0/src/write-mo.c 2003-01-12 15:35:24.000000000 +0100
--- gettext-1/src/write-mo.c 2003-01-23 00:48:35.000000000 +0100
***************
*** 157,167 ****
nstrings = 0;
msg_arr =
(struct pre_message *)
! alloca (mlp->nitems * sizeof (struct pre_message));
n_sysdep_strings = 0;
sysdep_msg_arr =
(struct pre_sysdep_message *)
! alloca (mlp->nitems * sizeof (struct pre_sysdep_message));
n_sysdep_segments = 0;
sysdep_segments = NULL;
for (j = 0; j < mlp->nitems; j++)
--- 157,167 ----
nstrings = 0;
msg_arr =
(struct pre_message *)
! xmalloc (mlp->nitems * sizeof (struct pre_message));
n_sysdep_strings = 0;
sysdep_msg_arr =
(struct pre_sysdep_message *)
! xmalloc (mlp->nitems * sizeof (struct pre_sysdep_message));
n_sysdep_segments = 0;
sysdep_segments = NULL;
for (j = 0; j < mlp->nitems; j++)
***************
*** 224,231 ****
{
struct pre_sysdep_string *pre =
(struct pre_sysdep_string *)
! alloca (sizeof (struct pre_sysdep_string)
! + nintervals[m] * sizeof (struct pre_segment_pair));
const char *str;
size_t str_len;
size_t lastpos;
--- 224,231 ----
{
struct pre_sysdep_string *pre =
(struct pre_sysdep_string *)
! xmalloc (sizeof (struct pre_sysdep_string)
! + nintervals[m] * sizeof (struct pre_segment_pair));
const char *str;
size_t str_len;
size_t lastpos;
***************
*** 374,386 ****
header.orig_tab_offset = offset;
offset += nstrings * sizeof (struct string_desc);
orig_tab =
! (struct string_desc *) alloca (nstrings * sizeof (struct string_desc));
/* Offset of table for translated string offsets. */
header.trans_tab_offset = offset;
offset += nstrings * sizeof (struct string_desc);
trans_tab =
! (struct string_desc *) alloca (nstrings * sizeof (struct string_desc));
/* Size of hash table. */
header.hash_tab_size = hash_tab_size;
--- 374,386 ----
header.orig_tab_offset = offset;
offset += nstrings * sizeof (struct string_desc);
orig_tab =
! (struct string_desc *) xmalloc (nstrings * sizeof (struct string_desc));
/* Offset of table for translated string offsets. */
header.trans_tab_offset = offset;
offset += nstrings * sizeof (struct string_desc);
trans_tab =
! (struct string_desc *) xmalloc (nstrings * sizeof (struct string_desc));
/* Size of hash table. */
header.hash_tab_size = hash_tab_size;
***************
*** 463,469 ****
/* Here output_file is at position header.hash_tab_offset. */
/* Allocate room for the hashing table to be written out. */
! hash_tab = (nls_uint32 *) alloca (hash_tab_size * sizeof (nls_uint32));
memset (hash_tab, '\0', hash_tab_size * sizeof (nls_uint32));
/* Insert all value in the hash table, following the algorithm described
--- 463,469 ----
/* Here output_file is at position header.hash_tab_offset. */
/* Allocate room for the hashing table to be written out. */
! hash_tab = (nls_uint32 *) xmalloc (hash_tab_size * sizeof (nls_uint32));
memset (hash_tab, '\0', hash_tab_size * sizeof (nls_uint32));
/* Insert all value in the hash table, following the algorithm described
***************
*** 492,498 ****
/* Write the hash table out. */
fwrite (hash_tab, hash_tab_size * sizeof (nls_uint32), 1, output_file);
! freea (hash_tab);
}
if (minor_revision >= 1)
--- 492,498 ----
/* Write the hash table out. */
fwrite (hash_tab, hash_tab_size * sizeof (nls_uint32), 1, output_file);
! free (hash_tab);
}
if (minor_revision >= 1)
***************
*** 506,512 ****
sysdep_segments_tab =
(struct sysdep_segment *)
! alloca (n_sysdep_segments * sizeof (struct sysdep_segment));
for (i = 0; i < n_sysdep_segments; i++)
{
offset = roundup (offset, alignment);
--- 506,512 ----
sysdep_segments_tab =
(struct sysdep_segment *)
! xmalloc (n_sysdep_segments * sizeof (struct sysdep_segment));
for (i = 0; i < n_sysdep_segments; i++)
{
offset = roundup (offset, alignment);
***************
*** 520,529 ****
n_sysdep_segments * sizeof (struct sysdep_segment), 1,
output_file);
! freea (sysdep_segments_tab);
sysdep_tab =
! (nls_uint32 *) alloca (n_sysdep_strings * sizeof (nls_uint32));
stoffset = sysdep_tab_offset;
for (m = 0; m < 2; m++)
--- 520,529 ----
n_sysdep_segments * sizeof (struct sysdep_segment), 1,
output_file);
! free (sysdep_segments_tab);
sysdep_tab =
! (nls_uint32 *) xmalloc (n_sysdep_strings * sizeof (nls_uint32));
stoffset = sysdep_tab_offset;
for (m = 0; m < 2; m++)
***************
*** 544,550 ****
output_file);
}
! freea (sysdep_tab);
/* Here output_file is at position sysdep_tab_offset. */
--- 544,550 ----
output_file);
}
! free (sysdep_tab);
/* Here output_file is at position sysdep_tab_offset. */
***************
*** 583,590 ****
/* Here output_file is at position end_offset. */
! freea (trans_tab);
! freea (orig_tab);
/* Fourth pass: Write the strings. */
--- 583,590 ----
/* Here output_file is at position end_offset. */
! free (trans_tab);
! free (orig_tab);
/* Fourth pass: Write the strings. */
***************
*** 657,669 ****
offset += msg->id_plural_len;
}
! freea (pre);
}
}
freea (null);
! freea (sysdep_msg_arr);
! freea (msg_arr);
}
--- 657,669 ----
offset += msg->id_plural_len;
}
! free (pre);
}
}
freea (null);
! free (sysdep_msg_arr);
! free (msg_arr);
}
- bug, liu jack, 2003/01/01