locale-util: mark special_glyph() as _const_
_const_ means that the caller can assume that the function will return the same result every time (and will not modify global memory). special_glyph() meets this: even though it depends on global memory, that part of global memory is not expected to change. This allows the calls to special_glyph() to be optimized, even if -flto is not used.
This commit is contained in:
parent
323b7dc903
commit
dff4bf93d4
|
@ -273,7 +273,7 @@ out:
|
||||||
|
|
||||||
const char *special_glyph(SpecialGlyph code) {
|
const char *special_glyph(SpecialGlyph code) {
|
||||||
|
|
||||||
static const char *draw_table[2][_SPECIAL_GLYPH_MAX] = {
|
static const char* const draw_table[2][_SPECIAL_GLYPH_MAX] = {
|
||||||
/* ASCII fallback */
|
/* ASCII fallback */
|
||||||
[false] = {
|
[false] = {
|
||||||
[TREE_VERTICAL] = "| ",
|
[TREE_VERTICAL] = "| ",
|
||||||
|
|
|
@ -67,7 +67,7 @@ typedef enum {
|
||||||
_SPECIAL_GLYPH_MAX
|
_SPECIAL_GLYPH_MAX
|
||||||
} SpecialGlyph;
|
} SpecialGlyph;
|
||||||
|
|
||||||
const char *special_glyph(SpecialGlyph code);
|
const char *special_glyph(SpecialGlyph code) _const_;
|
||||||
|
|
||||||
const char* locale_variable_to_string(LocaleVariable i) _const_;
|
const char* locale_variable_to_string(LocaleVariable i) _const_;
|
||||||
LocaleVariable locale_variable_from_string(const char *s) _pure_;
|
LocaleVariable locale_variable_from_string(const char *s) _pure_;
|
||||||
|
|
Loading…
Reference in a new issue