From 67b0b7be62caf2adba38d5e7d7690eed7f72edb4 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 27 Jul 2004 20:44:46 +0000 Subject: [project @ 2004-07-27 20:44:46 by jmb] Language configuration menu Make adjust clicks on font size arrows style guide compliant svn path=/import/netsurf/; revision=1154 --- utils/messages.c | 17 +++++++++++++++++ utils/messages.h | 1 + 2 files changed, 18 insertions(+) (limited to 'utils') diff --git a/utils/messages.c b/utils/messages.c index 4d07a47ef..f2ed3e037 100644 --- a/utils/messages.c +++ b/utils/messages.c @@ -121,6 +121,23 @@ const char *messages_get(const char *key) return entry->value; } +/** + * Retrieve the key associated with a value + * + * \param value The value as returned by messages_get + * \return The key associated with the value or NULL if not found + */ +const char *messages_get_key(const char *value) +{ + const char *key = value - MAX_KEY_LENGTH; + const char *temp_value = messages_get(key); + + if (strcmp(value, temp_value) == 0) + return key; + + return NULL; +} + /** * Hash function for keys. diff --git a/utils/messages.h b/utils/messages.h index 4ca079293..33b2fc3f4 100644 --- a/utils/messages.h +++ b/utils/messages.h @@ -23,6 +23,7 @@ void messages_load(const char *path); const char *messages_get(const char *key); +const char *messages_get_key(const char *value); void messages_dump(void); #endif -- cgit v1.2.3