You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Philip Martin <ph...@codematters.co.uk> on 2005/01/07 18:11:48 UTC
Re: svn commit: r12628 - in branches/locking/subversion: include
libsvn_client libsvn_ra_dav libsvn_ra_local libsvn_ra_svn
sussman@tigris.org writes:
> Author: sussman
> Date: Fri Jan 7 11:48:21 2005
> New Revision: 12628
> --- branches/locking/subversion/libsvn_ra_dav/session.c (original)
> +++ branches/locking/subversion/libsvn_ra_dav/session.c Fri Jan 7 11:48:21 2005
> @@ -1034,12 +1034,56 @@
>
> static svn_error_t *
> svn_ra_dav__unlock(void *session_baton,
> + const char *path,
> const char *token,
> svn_boolean_t force,
> apr_pool_t *pool)
> {
> - return svn_error_create (SVN_ERR_UNSUPPORTED_FEATURE, 0,
> - "Function not yet implemented.");
> + svn_ra_session_t *ras = session_baton;
> + int rv;
> + const char *url;
> + struct lock_request_baton *lrb;
> + struct ne_lock *nlock;
> +
> + /* Build context for neon callbacks and then register them. */
> + lrb = apr_pcalloc(pool, sizeof(*lrb));
> + lrb->force = force;
> + lrb->pool = pool;
> + ne_hook_create_request(ras->sess, create_request_hook, lrb);
> + ne_hook_pre_send(ras->sess, pre_send_hook, lrb);
> +
> + /* Make a neon lock structure containing token and full URL to unlock. */
> + nlock = ne_lock_create();
> + nlock->token = ne_strdup(token);
two mallocs, so not pool memory
> + url = svn_path_url_add_component (ras->url, path, pool);
> + if ((rv = ne_uri_parse(url, &(nlock->uri))))
> + return svn_ra_dav__convert_error(ras->sess, "Failed to parse URI",
> + rv, pool);
nlock is going out of scope so that return is a leak isn't it?
> +
> + /* Issue UNLOCK request. */
> + rv = ne_unlock(ras->sess, nlock);
> +
> + /* Did we get a <D:error> response? */
> + if (lrb->err)
> + {
> + ne_lock_destroy(nlock);
> + if (lrb->error_parser)
> + ne_xml_destroy(lrb->error_parser);
> +
> + return lrb->err;
> + }
> +
> + /* Did we get some other sort of neon error? */
> + if (rv)
> + return svn_ra_dav__convert_error(ras->sess,
> + "Lock request failed", rv, pool);
ditto
> +
> + /* Free neon things. */
> + ne_lock_destroy(nlock);
> + if (lrb->error_parser)
> + ne_xml_destroy(lrb->error_parser);
> +
> + return SVN_NO_ERROR;
> }
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: r12628 - in branches/locking/subversion: include libsvn_client libsvn_ra_dav libsvn_ra_local libsvn_ra_svn
Posted by Ben Collins-Sussman <su...@collab.net>.
Sorry, I never replied, but just committed the fixes. :-) See my
commits on the locking branch.
On Jan 12, 2005, at 6:04 PM, Julian Foad wrote:
> Ping...? (Just catching up on my mail after the break, and seeing no
> reply to this.)
>
> - Julian
>
>
> Philip Martin wrote:
>> sussman@tigris.org writes:
>>> Author: sussman
>>> Date: Fri Jan 7 11:48:21 2005
>>> New Revision: 12628
>>> --- branches/locking/subversion/libsvn_ra_dav/session.c (original)
>>> +++ branches/locking/subversion/libsvn_ra_dav/session.c Fri Jan 7
>>> 11:48:21 2005
>>> @@ -1034,12 +1034,56 @@
>>> static svn_error_t *
>>> svn_ra_dav__unlock(void *session_baton,
>>> + const char *path,
>>> const char *token,
>>> svn_boolean_t force,
>>> apr_pool_t *pool)
>>> {
>>> - return svn_error_create (SVN_ERR_UNSUPPORTED_FEATURE, 0,
>>> - "Function not yet implemented.");
>>> + svn_ra_session_t *ras = session_baton;
>>> + int rv;
>>> + const char *url;
>>> + struct lock_request_baton *lrb;
>>> + struct ne_lock *nlock;
>>> +
>>> + /* Build context for neon callbacks and then register them. */
>>> + lrb = apr_pcalloc(pool, sizeof(*lrb));
>>> + lrb->force = force;
>>> + lrb->pool = pool;
>>> + ne_hook_create_request(ras->sess, create_request_hook, lrb);
>>> + ne_hook_pre_send(ras->sess, pre_send_hook, lrb);
>>> +
>>> + /* Make a neon lock structure containing token and full URL to
>>> unlock. */
>>> + nlock = ne_lock_create();
>>> + nlock->token = ne_strdup(token);
>> two mallocs, so not pool memory
>>> + url = svn_path_url_add_component (ras->url, path, pool); + if
>>> ((rv = ne_uri_parse(url, &(nlock->uri))))
>>> + return svn_ra_dav__convert_error(ras->sess, "Failed to parse
>>> URI",
>>> + rv, pool);
>> nlock is going out of scope so that return is a leak isn't it?
>>> +
>>> + /* Issue UNLOCK request. */
>>> + rv = ne_unlock(ras->sess, nlock);
>>> +
>>> + /* Did we get a <D:error> response? */
>>> + if (lrb->err)
>>> + {
>>> + ne_lock_destroy(nlock);
>>> + if (lrb->error_parser)
>>> + ne_xml_destroy(lrb->error_parser);
>>> +
>>> + return lrb->err;
>>> + }
>>> +
>>> + /* Did we get some other sort of neon error? */
>>> + if (rv)
>>> + return svn_ra_dav__convert_error(ras->sess,
>>> + "Lock request failed", rv,
>>> pool);
>> ditto
>>> + + /* Free neon things. */
>>> + ne_lock_destroy(nlock);
>>> + if (lrb->error_parser)
>>> + ne_xml_destroy(lrb->error_parser);
>>> +
>>> + return SVN_NO_ERROR;
>>> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: r12628 - in branches/locking/subversion: include
libsvn_client libsvn_ra_dav libsvn_ra_local libsvn_ra_svn
Posted by Julian Foad <ju...@btopenworld.com>.
Ping...? (Just catching up on my mail after the break, and seeing no reply to
this.)
- Julian
Philip Martin wrote:
> sussman@tigris.org writes:
>
>
>>Author: sussman
>>Date: Fri Jan 7 11:48:21 2005
>>New Revision: 12628
>
>
>>--- branches/locking/subversion/libsvn_ra_dav/session.c (original)
>>+++ branches/locking/subversion/libsvn_ra_dav/session.c Fri Jan 7 11:48:21 2005
>>@@ -1034,12 +1034,56 @@
>>
>> static svn_error_t *
>> svn_ra_dav__unlock(void *session_baton,
>>+ const char *path,
>> const char *token,
>> svn_boolean_t force,
>> apr_pool_t *pool)
>> {
>>- return svn_error_create (SVN_ERR_UNSUPPORTED_FEATURE, 0,
>>- "Function not yet implemented.");
>>+ svn_ra_session_t *ras = session_baton;
>>+ int rv;
>>+ const char *url;
>>+ struct lock_request_baton *lrb;
>>+ struct ne_lock *nlock;
>>+
>>+ /* Build context for neon callbacks and then register them. */
>>+ lrb = apr_pcalloc(pool, sizeof(*lrb));
>>+ lrb->force = force;
>>+ lrb->pool = pool;
>>+ ne_hook_create_request(ras->sess, create_request_hook, lrb);
>>+ ne_hook_pre_send(ras->sess, pre_send_hook, lrb);
>>+
>>+ /* Make a neon lock structure containing token and full URL to unlock. */
>>+ nlock = ne_lock_create();
>>+ nlock->token = ne_strdup(token);
>
>
> two mallocs, so not pool memory
>
>
>>+ url = svn_path_url_add_component (ras->url, path, pool);
>>+ if ((rv = ne_uri_parse(url, &(nlock->uri))))
>>+ return svn_ra_dav__convert_error(ras->sess, "Failed to parse URI",
>>+ rv, pool);
>
>
> nlock is going out of scope so that return is a leak isn't it?
>
>
>>+
>>+ /* Issue UNLOCK request. */
>>+ rv = ne_unlock(ras->sess, nlock);
>>+
>>+ /* Did we get a <D:error> response? */
>>+ if (lrb->err)
>>+ {
>>+ ne_lock_destroy(nlock);
>>+ if (lrb->error_parser)
>>+ ne_xml_destroy(lrb->error_parser);
>>+
>>+ return lrb->err;
>>+ }
>>+
>>+ /* Did we get some other sort of neon error? */
>>+ if (rv)
>>+ return svn_ra_dav__convert_error(ras->sess,
>>+ "Lock request failed", rv, pool);
>
>
> ditto
>
>
>>+
>>+ /* Free neon things. */
>>+ ne_lock_destroy(nlock);
>>+ if (lrb->error_parser)
>>+ ne_xml_destroy(lrb->error_parser);
>>+
>>+ return SVN_NO_ERROR;
>> }
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org