summaryrefslogtreecommitdiffstats
path: root/gettext-tools
diff options
context:
space:
mode:
Diffstat (limited to 'gettext-tools')
-rw-r--r--gettext-tools/src/xgettext.c44
-rw-r--r--gettext-tools/src/xgettext.h4
2 files changed, 14 insertions, 34 deletions
diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c
index 339afcf..7481d3a 100644
--- a/gettext-tools/src/xgettext.c
+++ b/gettext-tools/src/xgettext.c
@@ -3247,40 +3247,22 @@ mixed_string_buffer_append_unicode (struct mixed_string_buffer *bp, int c)
char *
mixed_string_buffer_done (struct mixed_string_buffer *bp)
{
- if (bp->utf8_buffer || bp->utf16_surr != 0)
- {
- char *utf8_buffer;
-
- /* Flush all into bp->utf8_buffer. */
- mixed_string_buffer_flush_utf16_surr (bp);
- mixed_string_buffer_flush_curr_buffer (bp, bp->line_number);
- /* NUL-terminate it. */
- mixed_string_buffer_grow_utf8_buffer (bp, 1);
- bp->utf8_buffer[bp->utf8_buflen] = '\0';
-
- /* Free curr_buffer and bp itself. */
- utf8_buffer = bp->utf8_buffer;
- free (bp->curr_buffer);
- free (bp);
-
- /* Return it. */
- return utf8_buffer;
- }
- else
- {
- char *curr_buffer;
+ char *utf8_buffer;
- /* NUL-terminate it. */
- mixed_string_buffer_append_to_curr_buffer (bp, '\0');
+ /* Flush all into bp->utf8_buffer. */
+ mixed_string_buffer_flush_utf16_surr (bp);
+ mixed_string_buffer_flush_curr_buffer (bp, bp->line_number);
+ /* NUL-terminate it. */
+ mixed_string_buffer_grow_utf8_buffer (bp, 1);
+ bp->utf8_buffer[bp->utf8_buflen] = '\0';
- /* Free utf8_buffer and bp itself. */
- curr_buffer = bp->curr_buffer;
- free (bp->utf8_buffer);
- free (bp);
+ /* Free curr_buffer and bp itself. */
+ utf8_buffer = bp->utf8_buffer;
+ free (bp->curr_buffer);
+ free (bp);
- /* Return it. */
- return curr_buffer;
- }
+ /* Return it. */
+ return utf8_buffer;
}
diff --git a/gettext-tools/src/xgettext.h b/gettext-tools/src/xgettext.h
index 706309a..059a419 100644
--- a/gettext-tools/src/xgettext.h
+++ b/gettext-tools/src/xgettext.h
@@ -370,9 +370,7 @@ extern void mixed_string_buffer_append_char (struct mixed_string_buffer *bp,
extern void mixed_string_buffer_append_unicode (struct mixed_string_buffer *bp,
int c);
-/* Frees mixed_string_buffer and returns the accumulated string. If
- any Unicode character has been added to BP, the result is in UTF-8.
- Otherwise, it doesn't do any conversion. */
+/* Frees mixed_string_buffer and returns the accumulated string in UTF-8. */
extern char * mixed_string_buffer_done (struct mixed_string_buffer *bp);