-2009-09-15 Bruno Haible <bruno@clisp.org>
+2008-09-26 Bruno Haible <bruno@clisp.org>
+
+ * write-catalog.c (cmp_by_msgid, cmp_by_filepos): Compare the msgctxt
+ fields if the msgid fields are the same.
+ Reported by Rainer Tammer <tammer@tammer.net>.
+
+2008-09-15 Bruno Haible <bruno@clisp.org>
* Makefile.am (msg*_DEPENDENCIES, xgettext_DEPENDENCIES,
recode_sr_latin_DEPENDENCIES): New variables.
-2009-09-15 Bruno Haible <bruno@clisp.org>
+2008-09-15 Bruno Haible <bruno@clisp.org>
* msgl-fsearch.h: Include stdbool.h.
(message_fuzzy_index_search): Add 'heuristic' argument.
for a lazily allocated hashed index.
* Makefile.am (msgcmp_SOURCES): Add msgl-fsearch.c.
-2009-09-15 Bruno Haible <bruno@clisp.org>
+2008-09-15 Bruno Haible <bruno@clisp.org>
* msgcmp.c (use_fuzzy_matching): New variable.
(long_options): Add option -N/--no-fuzzy-matching.
/* GNU gettext - internationalization aids
- Copyright (C) 1995-1998, 2000-2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998, 2000-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
const message_ty *a = *(const message_ty **) va;
const message_ty *b = *(const message_ty **) vb;
- /* Because msgids normally contain only ASCII characters, it is OK to
- sort them as if we were in the C locale. And strcoll() in the C locale
- is the same as strcmp(). */
- return strcmp (a->msgid, b->msgid);
+
+ /* Because msgids normally contain only ASCII characters or are UTF-8
+ encoded, it is OK to sort them as if we were in a C.UTF-8 locale. And
+ strcoll() in a C.UTF-8 locale is the same as strcmp(). */
+ int cmp = strcmp (a->msgid, b->msgid);
+ if (cmp != 0)
+ return cmp;
+
+ /* If the msgids are equal, disambiguate by comparing the contexts. */
+ if (a->msgctxt == b->msgctxt)
+ return 0;
+ if (a->msgctxt == NULL)
+ return -1;
+ if (b->msgctxt == NULL)
+ return 1;
+ return strcmp (a->msgctxt, b->msgctxt);
}
return cmp;
/* If they are equal, compare on the msgid strings. */
- /* Because msgids normally contain only ASCII characters, it is OK to
- sort them as if we were in the C locale. And strcoll() in the C locale
- is the same as strcmp(). */
- return strcmp (a->msgid, b->msgid);
+ /* Because msgids normally contain only ASCII characters or are UTF-8
+ encoded, it is OK to sort them as if we were in a C.UTF-8 locale. And
+ strcoll() in a C.UTF-8 locale is the same as strcmp(). */
+ cmp = strcmp (a->msgid, b->msgid);
+ if (cmp != 0)
+ return cmp;
+
+ /* If the msgids are equal, disambiguate by comparing the contexts. */
+ if (a->msgctxt == b->msgctxt)
+ return 0;
+ if (a->msgctxt == NULL)
+ return -1;
+ if (b->msgctxt == NULL)
+ return 1;
+ return strcmp (a->msgctxt, b->msgctxt);
}