aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-01-29 16:24:16 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-01-29 16:24:16 +0800
commita96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4 (patch)
treee66755a8e11a5f6612fe0d4dabe5b7675731f9da
parentaadeb422d2dca792606159a24de45ce074170e0d (diff)
downloadgsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.gz
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.bz2
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.lz
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.xz
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.zst
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.zip
added a doc comment.
2004-01-29 Not Zed <NotZed@Ximian.com> * camel-object.c (camel_object_bag_rekey): added a doc comment. ** See bug #53520. * camel-session.c (get_service): free the url once done, it now gets copied by the service. * camel-service.c (construct): copy the url that comes in, don't just '0Wn34z' it. clena up exception handling too. svn path=/trunk/; revision=24513
-rw-r--r--camel/ChangeLog12
-rw-r--r--camel/camel-object.c12
-rw-r--r--camel/camel-service.c38
-rw-r--r--camel/camel-session.c29
4 files changed, 53 insertions, 38 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f3b2a50004..b5ad5d1ceb 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,17 @@
2004-01-29 Not Zed <NotZed@Ximian.com>
+ * camel-object.c (camel_object_bag_rekey): added a doc comment.
+
+ ** See bug #53520.
+
+ * camel-session.c (get_service): free the url once done, it now
+ gets copied by the service.
+
+ * camel-service.c (construct): copy the url that comes in, don't
+ just '0Wn34z' it. clena up exception handling too.
+
+2004-01-29 Not Zed <NotZed@Ximian.com>
+
* camel-object.c (cobject_state_write): output scan->name and
scan->value for writing metadata, rather than meta->name/value
which just duplicates the last entry, related to #53195.
diff --git a/camel/camel-object.c b/camel/camel-object.c
index 7ca9e84d8a..682c0e1924 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -1897,7 +1897,17 @@ camel_object_bag_abort(CamelObjectBag *bag, const void *key)
E_UNLOCK(type_lock);
}
-
+/**
+ * camel_object_bag_rekey:
+ * @bag:
+ * @o:
+ * @newkey:
+ *
+ * Re-key an object, atomically. The key for object @o is set to
+ * @newkey, in an atomic manner.
+ *
+ * It is an api (fatal) error if @o is not currently in the bag.
+ **/
void
camel_object_bag_rekey(CamelObjectBag *bag, void *o, const void *newkey)
{
diff --git a/camel/camel-service.c b/camel/camel-service.c
index cd66bb9cb1..b5f5b4bc4c 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -266,43 +266,37 @@ service_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
}
static void
-construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, CamelURL *url, CamelException *ex)
+construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, CamelException *ex)
{
- char *url_string;
+ char *err, *url_string;
if (CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_USER) &&
(url->user == NULL || url->user[0] == '\0')) {
- url_string = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- _("URL '%s' needs a username component"),
- url_string);
- g_free (url_string);
- return;
+ err = _("URL '%s' needs a username component");
+ goto fail;
} else if (CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_HOST) &&
(url->host == NULL || url->host[0] == '\0')) {
- url_string = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- _("URL '%s' needs a host component"),
- url_string);
- g_free (url_string);
- return;
+ err = _("URL '%s' needs a host component");
+ goto fail;
} else if (CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_PATH) &&
(url->path == NULL || url->path[0] == '\0')) {
- url_string = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- _("URL '%s' needs a path component"),
- url_string);
- g_free (url_string);
- return;
+ err = _("URL '%s' needs a path component");
+ goto fail;
}
service->provider = provider;
- service->url = url;
+ service->url = camel_url_copy(url);
service->session = session;
camel_object_ref (session);
service->status = CAMEL_SERVICE_DISCONNECTED;
+
+ return;
+
+fail:
+ url_string = camel_url_to_string(url, CAMEL_URL_HIDE_PASSWORD);
+ camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID, err, url_string);
+ g_free(url_string);
}
/**
diff --git a/camel/camel-session.c b/camel/camel-session.c
index 0e5efa1d9c..8b2268908e 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -416,22 +416,21 @@ get_service (CamelSession *session, const char *url_string,
/* Now look up the service in the provider's cache */
service = camel_object_bag_reserve(provider->service_cache[type], url);
- if (service != NULL) {
- camel_url_free (url);
- return service;
- }
-
- service = (CamelService *)camel_object_new (provider->object_types[type]);
- camel_exception_init (&internal_ex);
- camel_service_construct (service, session, provider, url, &internal_ex);
- if (camel_exception_is_set (&internal_ex)) {
- camel_exception_xfer (ex, &internal_ex);
- camel_object_unref (service);
- service = NULL;
- camel_object_bag_abort(provider->service_cache[type], url);
- } else {
- camel_object_bag_add(provider->service_cache[type], url, service);
+ if (service == NULL) {
+ service = (CamelService *)camel_object_new (provider->object_types[type]);
+ camel_exception_init (&internal_ex);
+ camel_service_construct (service, session, provider, url, &internal_ex);
+ if (camel_exception_is_set (&internal_ex)) {
+ camel_exception_xfer (ex, &internal_ex);
+ camel_object_unref (service);
+ service = NULL;
+ camel_object_bag_abort(provider->service_cache[type], url);
+ } else {
+ camel_object_bag_add(provider->service_cache[type], url, service);
+ }
}
+done:
+ camel_url_free (url);
return service;
}