pango r2700 - trunk/pango
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: pango r2700 - trunk/pango
- Date: Wed, 20 Aug 2008 18:59:47 +0000 (UTC)
Author: behdad
Date: Wed Aug 20 18:59:46 2008
New Revision: 2700
URL: http://svn.gnome.org/viewvc/pango?rev=2700&view=rev
Log:
Add a macro
Modified:
trunk/pango/pango-language.c
Modified: trunk/pango/pango-language.c
==============================================================================
--- trunk/pango/pango-language.c (original)
+++ trunk/pango/pango-language.c Wed Aug 20 18:59:46 2008
@@ -387,6 +387,12 @@
return NULL;
}
+#define FIND_BEST_LANG_MATCH(language, records) \
+ find_best_lang_match ((language), \
+ records, \
+ G_N_ELEMENTS (records), \
+ sizeof (*records));
+
typedef struct {
char lang[6];
guint16 offset;
@@ -413,6 +419,8 @@
#define LANGUAGE(id, source, sample) {G_STRINGIFY(id), G_STRUCT_OFFSET(union _LangPool, POOLSTRFIELD(__LINE__))},
#include "pango-language-sample-table.h"
#undef LANGUAGE
+ /* One extra entry with no final comma, to make it C89-happy */
+ {"~~", 0}
};
/**
@@ -449,10 +457,7 @@
if (!language)
language = pango_language_get_default ();
- lang_info = find_best_lang_match (language,
- lang_texts,
- G_N_ELEMENTS (lang_texts),
- sizeof (LangInfo));
+ lang_info = FIND_BEST_LANG_MATCH (language, lang_texts);
if (lang_info)
return lang_pool.str + lang_info->offset;
@@ -509,10 +514,7 @@
const PangoScriptForLang *script_for_lang;
unsigned int j;
- script_for_lang = find_best_lang_match (language,
- pango_script_for_lang,
- G_N_ELEMENTS (pango_script_for_lang),
- sizeof (PangoScriptForLang));
+ script_for_lang = FIND_BEST_LANG_MATCH (language, pango_script_for_lang);
if (!script_for_lang)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]