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 2004/01/24 19:28:35 UTC

Re: svn commit: r8490 - trunk/subversion/mod_dav_svn

cmpilato@tigris.org writes:

> Author: cmpilato
> Date: Sat Jan 24 10:28:52 2004
> New Revision: 8490
>
> Modified:
>    trunk/subversion/mod_dav_svn/activity.c
>    trunk/subversion/mod_dav_svn/dav_svn.h
>    trunk/subversion/mod_dav_svn/deadprops.c
>    trunk/subversion/mod_dav_svn/log.c
>    trunk/subversion/mod_dav_svn/merge.c
>    trunk/subversion/mod_dav_svn/repos.c
>    trunk/subversion/mod_dav_svn/update.c
>    trunk/subversion/mod_dav_svn/util.c
>    trunk/subversion/mod_dav_svn/version.c
> Log:
> Make dav_svn_convert_err() completely consume its svn_error_t * input.

> Modified: trunk/subversion/mod_dav_svn/util.c
> ==============================================================================
> --- trunk/subversion/mod_dav_svn/util.c	(original)
> +++ trunk/subversion/mod_dav_svn/util.c	Sat Jan 24 10:28:52 2004
> @@ -28,7 +28,7 @@
>  
>  
>  dav_error * dav_svn_convert_err(const svn_error_t *serr, int status,
> -                                const char *message)
> +                                const char *message, apr_pool_t *pool)
>  {
>      dav_error *derr;
>  
> @@ -51,13 +51,17 @@
>          /* add other mappings here */
>        }
>  
> -    derr = dav_new_error_tag(serr->pool, status,
> -                             serr->apr_err, serr->message,
> +    derr = dav_new_error_tag(pool, status,
> +                             serr->apr_err, apr_pstrdup(pool, serr->message),
>                               SVN_DAV_ERROR_NAMESPACE,
>                               SVN_DAV_ERROR_TAG);
>      if (message != NULL)
> -        derr = dav_push_error(serr->pool, status, serr->apr_err,
> +        derr = dav_push_error(pool, status, serr->apr_err,
>                                message, derr);
> +
> +    /* Now, destroy the Subversion error. */
> +    svn_error_clear(serr);

/home/pm/sw/subversion/svn/subversion/mod_dav_svn/util.c: In function `dav_svn_convert_err':
/home/pm/sw/subversion/svn/subversion/mod_dav_svn/util.c:63: warning: passing arg 1 of `svn_error_clear' discards qualifiers from pointer target type

If you want to pass the error as "const svn_error_t *" then I suggest
you change svn_error_clear as well.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r8490 - trunk/subversion/mod_dav_svn

Posted by Branko Čibej <br...@xbc.nu>.
Philip Martin wrote:

>Branko ÄŒibej <br...@xbc.nu> writes:
>
>  
>
>>And I suggest not passing a const svn_error_t* to a function that
>>modifies (destroys, that is) the object it points to.
>>    
>>
>
>It's not clear that passing a const pointer to such a function is an
>error; C++ allows const pointers to be passed to delete,
>
Yes, I've always found that strange.

>while C requires non-const pointers to be passed to free.
>  
>
I think we should do the same.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r8490 - trunk/subversion/mod_dav_svn

Posted by Philip Martin <ph...@codematters.co.uk>.
Branko Čibej <br...@xbc.nu> writes:

> And I suggest not passing a const svn_error_t* to a function that
> modifies (destroys, that is) the object it points to.

It's not clear that passing a const pointer to such a function is an
error; C++ allows const pointers to be passed to delete, while C
requires non-const pointers to be passed to free.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r8490 - trunk/subversion/mod_dav_svn

Posted by Branko Čibej <br...@xbc.nu>.
Philip Martin wrote:

>cmpilato@tigris.org writes:
>
>  
>
>>Author: cmpilato
>>Date: Sat Jan 24 10:28:52 2004
>>New Revision: 8490
>>
>>Modified:
>>   trunk/subversion/mod_dav_svn/activity.c
>>   trunk/subversion/mod_dav_svn/dav_svn.h
>>   trunk/subversion/mod_dav_svn/deadprops.c
>>   trunk/subversion/mod_dav_svn/log.c
>>   trunk/subversion/mod_dav_svn/merge.c
>>   trunk/subversion/mod_dav_svn/repos.c
>>   trunk/subversion/mod_dav_svn/update.c
>>   trunk/subversion/mod_dav_svn/util.c
>>   trunk/subversion/mod_dav_svn/version.c
>>Log:
>>Make dav_svn_convert_err() completely consume its svn_error_t * input.
>>    
>>
>
>  
>
>>Modified: trunk/subversion/mod_dav_svn/util.c
>>==============================================================================
>>--- trunk/subversion/mod_dav_svn/util.c	(original)
>>+++ trunk/subversion/mod_dav_svn/util.c	Sat Jan 24 10:28:52 2004
>>@@ -28,7 +28,7 @@
>> 
>> 
>> dav_error * dav_svn_convert_err(const svn_error_t *serr, int status,
>>-                                const char *message)
>>+                                const char *message, apr_pool_t *pool)
>> {
>>     dav_error *derr;
>> 
>>@@ -51,13 +51,17 @@
>>         /* add other mappings here */
>>       }
>> 
>>-    derr = dav_new_error_tag(serr->pool, status,
>>-                             serr->apr_err, serr->message,
>>+    derr = dav_new_error_tag(pool, status,
>>+                             serr->apr_err, apr_pstrdup(pool, serr->message),
>>                              SVN_DAV_ERROR_NAMESPACE,
>>                              SVN_DAV_ERROR_TAG);
>>     if (message != NULL)
>>-        derr = dav_push_error(serr->pool, status, serr->apr_err,
>>+        derr = dav_push_error(pool, status, serr->apr_err,
>>                               message, derr);
>>+
>>+    /* Now, destroy the Subversion error. */
>>+    svn_error_clear(serr);
>>    
>>
>
>/home/pm/sw/subversion/svn/subversion/mod_dav_svn/util.c: In function `dav_svn_convert_err':
>/home/pm/sw/subversion/svn/subversion/mod_dav_svn/util.c:63: warning: passing arg 1 of `svn_error_clear' discards qualifiers from pointer target type
>
>If you want to pass the error as "const svn_error_t *" then I suggest
>you change svn_error_clear as well.
>  
>
And I suggest not passing a const svn_error_t* to a function that
modifies (destroys, that is) the object it points to.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org