aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@src.gnome.org>2000-05-08 09:00:14 +0800
committerChris Toshok <toshok@src.gnome.org>2000-05-08 09:00:14 +0800
commit5aa0abfff8867dabcb22db7119709066b7120725 (patch)
treede92d97bd29c895137c30f3d4dd90946dd962c52
parent02165524394289e422f615bf1e1e5df093676e03 (diff)
downloadgsoc2013-evolution-5aa0abfff8867dabcb22db7119709066b7120725.tar
gsoc2013-evolution-5aa0abfff8867dabcb22db7119709066b7120725.tar.gz
gsoc2013-evolution-5aa0abfff8867dabcb22db7119709066b7120725.tar.bz2
gsoc2013-evolution-5aa0abfff8867dabcb22db7119709066b7120725.tar.lz
gsoc2013-evolution-5aa0abfff8867dabcb22db7119709066b7120725.tar.xz
gsoc2013-evolution-5aa0abfff8867dabcb22db7119709066b7120725.tar.zst
gsoc2013-evolution-5aa0abfff8867dabcb22db7119709066b7120725.zip
comment function, and fix an ABR.
* ename/e-name-western.c (e_name_western_cleanup_string): comment function, and fix an ABR. svn path=/trunk/; revision=2893
-rw-r--r--addressbook/ChangeLog5
-rw-r--r--addressbook/ename/e-name-western.c19
-rw-r--r--e-util/ename/e-name-western.c19
3 files changed, 31 insertions, 12 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index d510b59338..4a73b5d248 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,8 @@
+2000-05-07 Chris Toshok <toshok@helixcode.com>
+
+ * ename/e-name-western.c (e_name_western_cleanup_string): comment
+ function, and fix an ABR.
+
2000-05-08 Christopher James Lahey <clahey@helixcode.com>
* gui/minicard/e-minicard.c: Added saving in minicard view.
diff --git a/addressbook/ename/e-name-western.c b/addressbook/ename/e-name-western.c
index 98e03a6682..755d7eabed 100644
--- a/addressbook/ename/e-name-western.c
+++ b/addressbook/ename/e-name-western.c
@@ -51,18 +51,25 @@ e_name_western_cleanup_string (char **str)
if (*str == NULL)
return;
+ /* skip any spaces and commas at the start of the string */
p = *str;
while (isspace (*p) || *p == ',')
p ++;
+ /* make the copy we're going to return */
newstr = g_strdup (p);
- p = newstr + strlen (newstr) - 1;
- while (isspace (*p) || *p == ',')
- p --;
- if ((! isspace (*p)) && *p != ',')
- p ++;
- *p = '\0';
+ if ( strlen(newstr) > 0) {
+ /* now search from the back, skipping over any spaces and commas */
+ p = newstr + strlen (newstr) - 1;
+ while (isspace (*p) || *p == ',')
+ p --;
+ /* advance p to after the character that caused us to exit the
+ previous loop, and end the string. */
+ if ((! isspace (*p)) && *p != ',')
+ p ++;
+ *p = '\0';
+ }
g_free (*str);
*str = newstr;
diff --git a/e-util/ename/e-name-western.c b/e-util/ename/e-name-western.c
index 98e03a6682..755d7eabed 100644
--- a/e-util/ename/e-name-western.c
+++ b/e-util/ename/e-name-western.c
@@ -51,18 +51,25 @@ e_name_western_cleanup_string (char **str)
if (*str == NULL)
return;
+ /* skip any spaces and commas at the start of the string */
p = *str;
while (isspace (*p) || *p == ',')
p ++;
+ /* make the copy we're going to return */
newstr = g_strdup (p);
- p = newstr + strlen (newstr) - 1;
- while (isspace (*p) || *p == ',')
- p --;
- if ((! isspace (*p)) && *p != ',')
- p ++;
- *p = '\0';
+ if ( strlen(newstr) > 0) {
+ /* now search from the back, skipping over any spaces and commas */
+ p = newstr + strlen (newstr) - 1;
+ while (isspace (*p) || *p == ',')
+ p --;
+ /* advance p to after the character that caused us to exit the
+ previous loop, and end the string. */
+ if ((! isspace (*p)) && *p != ',')
+ p ++;
+ *p = '\0';
+ }
g_free (*str);
*str = newstr;