From a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 29 Jan 2004 08:24:16 +0000 Subject: added a doc comment. 2004-01-29 Not Zed * 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 --- camel/camel-service.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'camel/camel-service.c') 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); } /** -- cgit v1.2.3