From 99f5fef0ea5671d41fb7b737fbc3e4236542a757 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Jun 2014 23:56:05 +0200 Subject: Add more const While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need. --- common/msg.c | 2 +- common/msg_control.h | 2 +- common/version.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/msg.c b/common/msg.c index fa8b235243..9b05e55660 100644 --- a/common/msg.c +++ b/common/msg.c @@ -563,7 +563,7 @@ void mp_msg(struct mp_log *log, int lev, const char *format, ...) va_end(va); } -char *mp_log_levels[MSGL_MAX + 1] = { +const char *const mp_log_levels[MSGL_MAX + 1] = { [MSGL_FATAL] = "fatal", [MSGL_ERR] = "error", [MSGL_WARN] = "warn", diff --git a/common/msg_control.h b/common/msg_control.h index 755cd10e57..f659d180b2 100644 --- a/common/msg_control.h +++ b/common/msg_control.h @@ -31,6 +31,6 @@ int mp_msg_open_stats_file(struct mpv_global *global, const char *path); struct bstr; int mp_msg_split_msglevel(struct bstr *s, struct bstr *out_mod, int *out_level); -extern char *mp_log_levels[MSGL_MAX + 1]; +extern const char *const mp_log_levels[MSGL_MAX + 1]; #endif diff --git a/common/version.c b/common/version.c index 83177a5fc7..196b2ff807 100644 --- a/common/version.c +++ b/common/version.c @@ -22,5 +22,5 @@ #define BUILDDATE "UNKNOWN" #endif -const char *mpv_version = "mpv " VERSION; -const char *mpv_builddate = BUILDDATE; +const char *const mpv_version = "mpv " VERSION; +const char *const mpv_builddate = BUILDDATE; -- cgit v1.2.3