summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-05-09 11:24:08 -0400
committerSven Eden <yamakuzure@gmx.net>2017-06-16 10:12:58 +0200
commitf6999d6a1910bb438a7b1c051c44af50f14b42a8 (patch)
tree51ca361fb9db13a34f821271f4ca536a568d9fac /src
parentbcd8aec4ff66a0f27b46d47df49e184da57a68b0 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/basic/locale-util.c2
-rw-r--r--src/basic/locale-util.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c
index 8134f61a7..ada0a28cd 100644
--- a/src/basic/locale-util.c
+++ b/src/basic/locale-util.c
@@ -273,7 +273,7 @@ out:
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 */
[false] = {
[TREE_VERTICAL] = "| ",
diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h
index 353b7845f..0630a034a 100644
--- a/src/basic/locale-util.h
+++ b/src/basic/locale-util.h
@@ -67,7 +67,7 @@ typedef enum {
_SPECIAL_GLYPH_MAX
} SpecialGlyph;
-const char *special_glyph(SpecialGlyph code);
+const char *special_glyph(SpecialGlyph code) _const_;
const char* locale_variable_to_string(LocaleVariable i) _const_;
LocaleVariable locale_variable_from_string(const char *s) _pure_;