diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-10-11 21:12:36 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-10-11 21:12:36 +0800 |
commit | fefc4bfb69cb7a69c87328c132ed8f38142b6a74 (patch) | |
tree | 0a7649ac88d928f1695356c048ee015ad6fee948 | |
parent | 52bea0e3e7e817c1c7a99acc2c75bb9658285a9e (diff) | |
download | gsoc2013-epiphany-fefc4bfb69cb7a69c87328c132ed8f38142b6a74.tar gsoc2013-epiphany-fefc4bfb69cb7a69c87328c132ed8f38142b6a74.tar.gz gsoc2013-epiphany-fefc4bfb69cb7a69c87328c132ed8f38142b6a74.tar.bz2 gsoc2013-epiphany-fefc4bfb69cb7a69c87328c132ed8f38142b6a74.tar.lz gsoc2013-epiphany-fefc4bfb69cb7a69c87328c132ed8f38142b6a74.tar.xz gsoc2013-epiphany-fefc4bfb69cb7a69c87328c132ed8f38142b6a74.tar.zst gsoc2013-epiphany-fefc4bfb69cb7a69c87328c132ed8f38142b6a74.zip |
Fix constness and don't strdup when returning early.
2005-10-10 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-string.c: (ephy_string_shorten):
Fix constness and don't strdup when returning early.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/ephy-string.c | 4 | ||||
-rw-r--r-- | lib/ephy-string.h | 2 |
3 files changed, 9 insertions, 3 deletions
@@ -1,5 +1,11 @@ 2005-10-10 Christian Persch <chpe@cvs.gnome.org> + * lib/ephy-string.c: (ephy_string_shorten): + + Fix constness and don't strdup when returning early. + +2005-10-10 Christian Persch <chpe@cvs.gnome.org> + * lib/ephy-string.c: (ephy_string_blank_chr), (ephy_string_shorten): * lib/ephy-string.h: 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); diff --git a/lib/ephy-string.h b/lib/ephy-string.h index 86ab9eafc..d5b932ba0 100644 --- a/lib/ephy-string.h +++ b/lib/ephy-string.h @@ -30,7 +30,7 @@ gboolean ephy_string_to_int (const char *string, char *ephy_string_blank_chr (char *source); -char *ephy_string_shorten (const char *str, +char *ephy_string_shorten (char *str, gsize target_length); G_END_DECLS |