mirror of git://git.sysmocom.de/ofono
util: Use L_ARRAY_SIZE instead of TABLE_SIZE
This commit is contained in:
parent
506243ef67
commit
674b28f150
86
src/util.c
86
src/util.c
|
@ -30,6 +30,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
|
@ -65,9 +66,6 @@
|
|||
#define UTF8_LENGTH(c) \
|
||||
((c) < 0x80 ? 1 : ((c) < 0x800 ? 2 : 3))
|
||||
|
||||
#define TABLE_SIZE(t) \
|
||||
(sizeof((t)) / sizeof(struct codepoint))
|
||||
|
||||
struct codepoint {
|
||||
unsigned short from;
|
||||
unsigned short to;
|
||||
|
@ -2698,79 +2696,79 @@ static gboolean populate_locking_shift(struct conversion_table *t,
|
|||
case GSM_DIALECT_SPANISH:
|
||||
t->locking_g = def_gsm;
|
||||
t->locking_u = def_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(def_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(def_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_TURKISH:
|
||||
t->locking_g = tur_gsm;
|
||||
t->locking_u = tur_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(tur_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(tur_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_PORTUGUESE:
|
||||
t->locking_g = por_gsm;
|
||||
t->locking_u = por_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(por_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(por_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_BENGALI:
|
||||
t->locking_g = ben_gsm;
|
||||
t->locking_u = ben_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(ben_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(ben_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_GUJARATI:
|
||||
t->locking_g = guj_gsm;
|
||||
t->locking_u = guj_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(guj_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(guj_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_HINDI:
|
||||
t->locking_g = hin_gsm;
|
||||
t->locking_u = hin_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(hin_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(hin_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_KANNADA:
|
||||
t->locking_g = kan_gsm;
|
||||
t->locking_u = kan_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(kan_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(kan_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_MALAYALAM:
|
||||
t->locking_g = mal_gsm;
|
||||
t->locking_u = mal_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(mal_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(mal_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_ORIYA:
|
||||
t->locking_g = ori_gsm;
|
||||
t->locking_u = ori_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(ori_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(ori_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_PUNJABI:
|
||||
t->locking_g = pun_gsm;
|
||||
t->locking_u = pun_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(pun_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(pun_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_TAMIL:
|
||||
t->locking_g = tam_gsm;
|
||||
t->locking_u = tam_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(tam_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(tam_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_TELUGU:
|
||||
t->locking_g = tel_gsm;
|
||||
t->locking_u = tel_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(tel_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(tel_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_URDU:
|
||||
t->locking_g = urd_gsm;
|
||||
t->locking_u = urd_unicode;
|
||||
t->locking_len_u = TABLE_SIZE(urd_unicode);
|
||||
t->locking_len_u = L_ARRAY_SIZE(urd_unicode);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2783,100 +2781,100 @@ static gboolean populate_single_shift(struct conversion_table *t,
|
|||
switch (lang) {
|
||||
case GSM_DIALECT_DEFAULT:
|
||||
t->single_g = def_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(def_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(def_ext_gsm);
|
||||
t->single_u = def_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(def_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(def_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_TURKISH:
|
||||
t->single_g = tur_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(tur_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(tur_ext_gsm);
|
||||
t->single_u = tur_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(tur_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(tur_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_SPANISH:
|
||||
t->single_g = spa_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(spa_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(spa_ext_gsm);
|
||||
t->single_u = spa_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(spa_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(spa_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_PORTUGUESE:
|
||||
t->single_g = por_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(por_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(por_ext_gsm);
|
||||
t->single_u = por_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(por_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(por_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_BENGALI:
|
||||
t->single_g = ben_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(ben_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(ben_ext_gsm);
|
||||
t->single_u = ben_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(ben_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(ben_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_GUJARATI:
|
||||
t->single_g = guj_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(guj_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(guj_ext_gsm);
|
||||
t->single_u = guj_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(guj_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(guj_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_HINDI:
|
||||
t->single_g = hin_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(hin_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(hin_ext_gsm);
|
||||
t->single_u = hin_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(hin_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(hin_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_KANNADA:
|
||||
t->single_g = kan_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(kan_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(kan_ext_gsm);
|
||||
t->single_u = kan_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(kan_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(kan_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_MALAYALAM:
|
||||
t->single_g = mal_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(mal_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(mal_ext_gsm);
|
||||
t->single_u = mal_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(mal_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(mal_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_ORIYA:
|
||||
t->single_g = ori_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(ori_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(ori_ext_gsm);
|
||||
t->single_u = ori_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(ori_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(ori_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_PUNJABI:
|
||||
t->single_g = pun_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(pun_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(pun_ext_gsm);
|
||||
t->single_u = pun_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(pun_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(pun_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_TAMIL:
|
||||
t->single_g = tam_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(tam_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(tam_ext_gsm);
|
||||
t->single_u = tam_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(tam_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(tam_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_TELUGU:
|
||||
t->single_g = tel_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(tel_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(tel_ext_gsm);
|
||||
t->single_u = tel_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(tel_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(tel_ext_unicode);
|
||||
return TRUE;
|
||||
|
||||
case GSM_DIALECT_URDU:
|
||||
t->single_g = urd_ext_gsm;
|
||||
t->single_len_g = TABLE_SIZE(urd_ext_gsm);
|
||||
t->single_len_g = L_ARRAY_SIZE(urd_ext_gsm);
|
||||
t->single_u = urd_ext_unicode;
|
||||
t->single_len_u = TABLE_SIZE(urd_ext_unicode);
|
||||
t->single_len_u = L_ARRAY_SIZE(urd_ext_unicode);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue