From fefc4bfb69cb7a69c87328c132ed8f38142b6a74 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 11 Oct 2005 13:12:36 +0000 Subject: Fix constness and don't strdup when returning early. 2005-10-10 Christian Persch * lib/ephy-string.c: (ephy_string_shorten): Fix constness and don't strdup when returning early. --- lib/ephy-string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/ephy-string.c') diff --git a/lib/ephy-string.c b/lib/ephy-string.c index f996a7fe3..f16571cd1 100644 --- a/lib/ephy-string.c +++ b/lib/ephy-string.c @@ -100,7 +100,7 @@ ephy_string_blank_chr (char *source) * characters. */ char * -ephy_string_shorten (const char *str, +ephy_string_shorten (char *str, gsize target_length) { char *new_str; @@ -119,7 +119,7 @@ ephy_string_shorten (const char *str, /* if the string is already short enough, or if it's too short for * us to shorten it, return a new copy */ - if (actual_length <= target_length) return g_strdup (str); + if (actual_length <= target_length) return str; /* create string */ bytes = GPOINTER_TO_UINT (g_utf8_offset_to_pointer (str, target_length - 1) - str); -- cgit v1.2.3