equal
deleted
inserted
replaced
40 |
40 |
41 static const union HB_STRING_ARRAY_TYPE_NAME { |
41 static const union HB_STRING_ARRAY_TYPE_NAME { |
42 struct { |
42 struct { |
43 /* I like to avoid storing the nul-termination byte since we don't need it, |
43 /* I like to avoid storing the nul-termination byte since we don't need it, |
44 * but C++ does not allow that. |
44 * but C++ does not allow that. |
45 * https://stackoverflow.com/questions/28433862/why-initializer-string-for-array-of-chars-is-too-long-compiles-fine-in-c-not |
45 * https://stackoverflow.com/q/28433862 |
46 */ |
46 */ |
47 #define _S(s) char HB_PASTE (str, __LINE__)[sizeof (s)]; |
47 #define _S(s) char HB_PASTE (str, __LINE__)[sizeof (s)]; |
48 #include HB_STRING_ARRAY_LIST |
48 #include HB_STRING_ARRAY_LIST |
49 #undef _S |
49 #undef _S |
50 } st; |
50 } st; |
64 #include HB_STRING_ARRAY_LIST |
64 #include HB_STRING_ARRAY_LIST |
65 #undef _S |
65 #undef _S |
66 sizeof (HB_STRING_ARRAY_TYPE_NAME) |
66 sizeof (HB_STRING_ARRAY_TYPE_NAME) |
67 }; |
67 }; |
68 |
68 |
69 static inline hb_string_t |
69 static inline hb_bytes_t |
70 HB_STRING_ARRAY_NAME (unsigned int i) |
70 HB_STRING_ARRAY_NAME (unsigned int i) |
71 { |
71 { |
72 assert (i < ARRAY_LENGTH (HB_STRING_ARRAY_OFFS_NAME) - 1); |
72 assert (i < ARRAY_LENGTH (HB_STRING_ARRAY_OFFS_NAME) - 1); |
73 return hb_string_t (HB_STRING_ARRAY_POOL_NAME.str + HB_STRING_ARRAY_OFFS_NAME[i], |
73 return hb_bytes_t (HB_STRING_ARRAY_POOL_NAME.str + HB_STRING_ARRAY_OFFS_NAME[i], |
74 HB_STRING_ARRAY_OFFS_NAME[i + 1] - HB_STRING_ARRAY_OFFS_NAME[i] - 1); |
74 HB_STRING_ARRAY_OFFS_NAME[i + 1] - HB_STRING_ARRAY_OFFS_NAME[i] - 1); |
75 } |
75 } |
76 |
76 |
77 #undef HB_STRING_ARRAY_TYPE_NAME |
77 #undef HB_STRING_ARRAY_TYPE_NAME |
78 #undef HB_STRING_ARRAY_POOL_NAME |
78 #undef HB_STRING_ARRAY_POOL_NAME |
79 #undef HB_STRING_ARRAY_OFFS_NAME |
79 #undef HB_STRING_ARRAY_OFFS_NAME |