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
This commit is contained in:
Not Zed
2004-01-29 08:24:16 +00:00
committed by Michael Zucci
parent aadeb422d2
commit a96a5b7420
4 changed files with 53 additions and 38 deletions

View File

@ -1,3 +1,15 @@
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

View File

@ -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)
{

View File

@ -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);
}
/**

View File

@ -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;
}