soylent r143 - trunk/src
- From: treitter svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r143 - trunk/src
- Date: Sun, 25 May 2008 17:57:50 +0000 (UTC)
Author: treitter
Date: Sun May 25 17:57:50 2008
New Revision: 143
URL: http://svn.gnome.org/viewvc/soylent?rev=143&view=rev
Log:
return a statically-allocated string for eds_im_field_id_to_vcard_attr(); no need to dynamically allocate one
Modified:
trunk/src/eds-utils.c
trunk/src/eds-utils.h
Modified: trunk/src/eds-utils.c
==============================================================================
--- trunk/src/eds-utils.c (original)
+++ trunk/src/eds-utils.c Sun May 25 17:57:50 2008
@@ -251,7 +251,7 @@
*/
GList *attr_list = NULL;
EVCardAttribute *attr = NULL;
- gchar *attr_name = NULL;
+ const gchar *attr_name = NULL;
/*
GList *type_existing = NULL;
*/
@@ -308,7 +308,9 @@
attr_list = g_list_prepend (attr_list, attr);
e_contact_set_attributes (e_contact, field_id, attr_list);
+ /*
g_free (attr_name);
+ */
#if 0
/* XXX: the abs_num >= 0 check seems unnecessary */
@@ -609,15 +611,18 @@
}
#endif
-/* Return a newly-allocated vCard attribute name for the given EContactField ID.
+/* Return a vCard attribute name for the given EContactField ID. This string
+ * must not be freed or modified.
* Eg, E_CONTACT_IM_AIM -> "X-AIM" */
-gchar*
+const gchar*
eds_im_field_id_to_vcard_attr (EContactField field_id)
{
gchar *retval = NULL;
const gchar *field_name = NULL;
const gchar *proto_name = NULL;
+ /*
gchar *proto_name_uc = NULL;
+ */
g_return_val_if_fail (E_CONTACT_FIELD_IS_VALID (field_id), retval);
/* XXX: kind of ugly; breaks if this ordering changes and prevents us from
@@ -630,15 +635,50 @@
/* format of the field name is "im_<protocol in lower case>" */
proto_name = field_name + strlen("im_");
+ if (!g_ascii_strcasecmp (proto_name, "AIM"))
+ {
+ retval = EVC_X_AIM;
+ }
+ else if (!g_ascii_strcasecmp (proto_name, "GROUPWISE"))
+ {
+ retval = EVC_X_GROUPWISE;
+ }
+ else if (!g_ascii_strcasecmp (proto_name, "JABBER"))
+ {
+ retval = EVC_X_JABBER;
+ }
+ else if (!g_ascii_strcasecmp (proto_name, "YAHOO"))
+ {
+ retval = EVC_X_YAHOO;
+ }
+ else if (!g_ascii_strcasecmp (proto_name, "MSN"))
+ {
+ retval = EVC_X_MSN;
+ }
+ else if (!g_ascii_strcasecmp (proto_name, "ICQ"))
+ {
+ retval = EVC_X_ICQ;
+ }
+ else if (!g_ascii_strcasecmp (proto_name, "GADUGADU"))
+ {
+ retval = EVC_X_GADUGADU;
+ }
+
+ /*
proto_name_uc = g_ascii_strup (proto_name, -1);
retval = g_strdup_printf ("X-%s", proto_name_uc);
+ */
g_debug ("field name: %s", field_name);
+ /*
g_debug ("proto name: %s", proto_name);
g_debug ("proto name upper case: %s", proto_name_uc);
+ */
g_debug ("final attr name: %s", retval);
+ /*
g_free (proto_name_uc);
+ */
return retval;
}
Modified: trunk/src/eds-utils.h
==============================================================================
--- trunk/src/eds-utils.h (original)
+++ trunk/src/eds-utils.h Sun May 25 17:57:50 2008
@@ -54,6 +54,6 @@
const gchar *value);
gchar* eds_get_name_file_as_from_full (const gchar *full_name);
-gchar* eds_im_field_id_to_vcard_attr (EContactField field_id);
+const gchar* eds_im_field_id_to_vcard_attr (EContactField field_id);
#endif /* _EDS_UTILS_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]