Bugzilla – Bug 287150
xgettext: Extracting comment blocks from YCP files
Last modified: 2007-07-11 13:09:20 UTC
Please, apply the following patch From: Bruno Haible <bruno@clisp.org> Subject: Re: xgettext: Extracting comment blocks from YCP files To: Karl Eichwalder <ke@suse.de>, bug-gnu-gettext@gnu.org Cc: jdsn@suse.de Date: Tue, 19 Jun 2007 03:41:43 +0200 > The fact that inserting a newline between "xxx" and ) causes xgettext to > lose the comment is a bug. Here is a fix for this bug. *** gettext-tools/src/x-ycp.c 19 Feb 2007 03:31:37 -0000 1.16 --- gettext-tools/src/x-ycp.c 19 Jun 2007 01:36:53 -0000 *************** *** 329,334 **** --- 329,335 ---- { token_type_ty type; char *string; /* for token_type_string_literal, token_type_symbol */ + refcounted_string_list_ty *comment; /* for token_type_string_literal */ int line_number; }; *************** *** 405,410 **** --- 406,422 ---- } + /* Free the memory pointed to by a 'struct token_ty'. */ + static inline void + free_token (token_ty *tp) + { + if (tp->type == token_type_string_literal || tp->type == token_type_symbol) + free (tp->string); + if (tp->type == token_type_string_literal) + drop_reference (tp->comment); + } + + /* Combine characters into tokens. Discard whitespace. */ static token_ty phase5_pushback[1]; *************** *** 532,537 **** --- 544,550 ---- buffer[bufpos] = '\0'; tp->string = xstrdup (buffer); tp->type = token_type_string_literal; + tp->comment = add_reference (savable_comment); return; case '(': *************** *** 592,598 **** len = strlen (tp->string); tp->string = xrealloc (tp->string, len + strlen (tmp.string) + 1); strcpy (tp->string + len, tmp.string); ! free (tmp.string); } } --- 605,611 ---- len = strlen (tp->string); tp->string = xrealloc (tp->string, len + strlen (tmp.string) + 1); strcpy (tp->string + len, tmp.string); ! free_token (&tmp); } } *************** *** 672,678 **** /* Seen an msgid. */ plural_mp = remember_a_message (mlp, NULL, token.string, inner_context, &pos, ! savable_comment); state = 2; } else --- 685,691 ---- /* Seen an msgid. */ plural_mp = remember_a_message (mlp, NULL, token.string, inner_context, &pos, ! token.comment); state = 2; } else *************** *** 680,692 **** /* Seen an msgid_plural. */ remember_a_message_plural (plural_mp, token.string, inner_context, &pos, ! savable_comment); state = 0; } } else { ! free (token.string); state = 0; } next_context_iter = null_context_list_iterator; --- 693,706 ---- /* Seen an msgid_plural. */ remember_a_message_plural (plural_mp, token.string, inner_context, &pos, ! token.comment); state = 0; } + drop_reference (token.comment); } else { ! free_token (&token); state = 0; } next_context_iter = null_context_list_iterator; *************** *** 698,704 **** flag_context_list_table_lookup ( flag_context_list_table, token.string, strlen (token.string))); ! free (token.string); state = 0; continue; --- 712,718 ---- flag_context_list_table_lookup ( flag_context_list_table, token.string, strlen (token.string))); ! free_token (&token); state = 0; continue;
Patch added for STABLE/FACTORY. Please check after the package has been rebuilt and mark as verified if fixed.