Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 03 Nov 2013 00:51:03 UTC Commit: 02852b33b07491d99ad44f6f58fd654bee76244e https://github.com/geany/geany/commit/02852b33b07491d99ad44f6f58fd654bee7624...
Log Message: ----------- Simplify utils_get_hex_from_color() and plug a possible memory leak in it
Modified Paths: -------------- src/utils.c
Modified: src/utils.c 12 files changed, 4 insertions(+), 8 deletions(-) =================================================================== @@ -863,16 +863,12 @@ gchar *utils_get_setting_string(GKeyFile *config, const gchar *section, const gc
gchar *utils_get_hex_from_color(GdkColor *color) { - gchar *buffer = g_malloc0(9); - g_return_val_if_fail(color != NULL, NULL);
- g_snprintf(buffer, 8, "#%02X%02X%02X", - (guint) (utils_scale_round(color->red / 256, 255)), - (guint) (utils_scale_round(color->green / 256, 255)), - (guint) (utils_scale_round(color->blue / 256, 255))); - - return buffer; + return g_strdup_printf("#%02X%02X%02X", + (guint) (utils_scale_round(color->red / 256, 255)), + (guint) (utils_scale_round(color->green / 256, 255)), + (guint) (utils_scale_round(color->blue / 256, 255))); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).