Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/4ad375c3b0e3f65416c02ca7b126b2e7fe375db1
...commit
http://git.netsurf-browser.org/netsurf.git/commit/4ad375c3b0e3f65416c02ca7b126b2e7fe375db1
...tree
http://git.netsurf-browser.org/netsurf.git/tree/4ad375c3b0e3f65416c02ca7b126b2e7fe375db1
The branch, master has been updated
via 4ad375c3b0e3f65416c02ca7b126b2e7fe375db1 (commit)
from ba0895121b44b21d351ee69a07613f524f322617 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=4ad375c3b0e3f65416c02ca7b126b2e7fe375db1
commit 4ad375c3b0e3f65416c02ca7b126b2e7fe375db1
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Ensure memory used by Messages is freed on exit
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index d129ef7..4a14737 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -279,6 +279,9 @@ void netsurf_exit(void)
LOG("Destroying System colours");
ns_system_colour_finalize();
+ LOG("Destroying Messages");
+ messages_destroy();
+
corestrings_fini();
LOG("Remaining lwc strings:");
lwc_iterate_strings(netsurf_lwc_iterator, NULL);
diff --git a/utils/messages.c b/utils/messages.c
index e69a855..0c558cd 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -177,6 +177,22 @@ messages_get_ctx(const char *key, struct hash_table *ctx)
return r;
}
+
+/**
+ * Free memory used by a messages hash.
+ * The context will not be valid after this function returns.
+ *
+ * \param ctx context of messages file to free
+ */
+static void messages_destroy_ctx(struct hash_table *ctx)
+{
+ if (ctx == NULL)
+ return;
+
+ hash_destroy(ctx);
+}
+
+
/* exported interface documented in messages.h */
nserror messages_add_from_file(const char *path)
{
@@ -390,3 +406,12 @@ const char *messages_get_errorcode(nserror code)
/* Unknown error */
return messages_get_ctx("Unknown", messages_hash);
}
+
+
+/* exported function documented in utils/messages.h */
+void messages_destroy(void)
+{
+ messages_destroy_ctx(messages_hash);
+ messages_hash = NULL;
+}
+
diff --git a/utils/messages.h b/utils/messages.h
index 784e5fe..d4be893 100644
--- a/utils/messages.h
+++ b/utils/messages.h
@@ -90,4 +90,12 @@ const char *messages_get_errorcode(nserror code);
char *messages_get_buff(const char *key, ...);
+/**
+ * Free memory used by the standard Messages hash
+ *
+ * \param code errorcode of message
+ * \return message text
+ */
+void messages_destroy(void);
+
#endif
-----------------------------------------------------------------------
Summary of changes:
desktop/netsurf.c | 3 +++
utils/messages.c | 25 +++++++++++++++++++++++++
utils/messages.h | 8 ++++++++
3 files changed, 36 insertions(+)
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index d129ef7..4a14737 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -279,6 +279,9 @@ void netsurf_exit(void)
LOG("Destroying System colours");
ns_system_colour_finalize();
+ LOG("Destroying Messages");
+ messages_destroy();
+
corestrings_fini();
LOG("Remaining lwc strings:");
lwc_iterate_strings(netsurf_lwc_iterator, NULL);
diff --git a/utils/messages.c b/utils/messages.c
index e69a855..0c558cd 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -177,6 +177,22 @@ messages_get_ctx(const char *key, struct hash_table *ctx)
return r;
}
+
+/**
+ * Free memory used by a messages hash.
+ * The context will not be valid after this function returns.
+ *
+ * \param ctx context of messages file to free
+ */
+static void messages_destroy_ctx(struct hash_table *ctx)
+{
+ if (ctx == NULL)
+ return;
+
+ hash_destroy(ctx);
+}
+
+
/* exported interface documented in messages.h */
nserror messages_add_from_file(const char *path)
{
@@ -390,3 +406,12 @@ const char *messages_get_errorcode(nserror code)
/* Unknown error */
return messages_get_ctx("Unknown", messages_hash);
}
+
+
+/* exported function documented in utils/messages.h */
+void messages_destroy(void)
+{
+ messages_destroy_ctx(messages_hash);
+ messages_hash = NULL;
+}
+
diff --git a/utils/messages.h b/utils/messages.h
index 784e5fe..d4be893 100644
--- a/utils/messages.h
+++ b/utils/messages.h
@@ -90,4 +90,12 @@ const char *messages_get_errorcode(nserror code);
char *messages_get_buff(const char *key, ...);
+/**
+ * Free memory used by the standard Messages hash
+ *
+ * \param code errorcode of message
+ * \return message text
+ */
+void messages_destroy(void);
+
#endif
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org