You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2012/12/04 22:59:59 UTC

Combine and rename WC APIs that check WC root and switched

These six APIs all overlap in functionality:

1) svn_wc_check_root(*is_wcroot,*is_switched,*kind,...)
    2 uses in 2 files

2) svn_wc__check_wc_root(*wc_root,*kind,*switched,...)
    5 uses in 4 files

3) svn_wc__db_is_switched(*is_wcroot,*is_switched,*kind,...)
    5 uses in 4 files

4) svn_wc_is_wc_root2(*wc_root,...)
    1 use in 1 file (deprecated.c)

5) svn_wc__strictly_is_wc_root(*wc_root,...)
    5 uses in 5 files

6) svn_wc__db_is_wcroot(*is_root,...)
    15 uses in 6 files


The first three are functionally identical AFAICT.  The duplication adds noise to the WC internal API as a whole.  The first to go is svn_wc__check_wc_root() ... gone, r1417181+r1417184.


Now, (1) is a simple wrapper around (3) and (5) is a simple wrapper around (6).  Such pairs should have matching names.  (1) is public so can't change, so I'll rename (3) to match it:

(3) -> 'svn_wc__db_check_root'

and (5) is named 'strictly' to distinguish it from (4), so I'll leave it alone and rename (6) to match it:

(6) -> 'svn_wc__db_strictly_is_wc_root'.

That should help reduce the obfuscation a tiny bit.

- Julian


--
Certified & Supported Apache Subversion Downloads: http://www.wandisco.com/subversion/download

Re: Combine and rename WC APIs that check WC root and switched

Posted by Julian Foad <ju...@btopenworld.com>.
I (Julian Foad) wrote:

> These six APIs all overlap in functionality:
> 
> 1) svn_wc_check_root(*is_wcroot,*is_switched,*kind,...)
>     2 uses in 2 files
> 
> 2) svn_wc__check_wc_root(*wc_root,*kind,*switched,...)
>     5 uses in 4 files
> 
> 3) svn_wc__db_is_switched(*is_wcroot,*is_switched,*kind,...)
>     5 uses in 4 files
> 
> 4) svn_wc_is_wc_root2(*wc_root,...)
>     1 use in 1 file (deprecated.c)
> 
> 5) svn_wc__strictly_is_wc_root(*wc_root,...)
>     5 uses in 5 files
> 
> 6) svn_wc__db_is_wcroot(*is_root,...)
>     15 uses in 6 files
> 
> 
> The first three are functionally identical AFAICT.  The duplication adds noise 
> to the WC internal API as a whole.  The first to go is svn_wc__check_wc_root() 
> ... gone, r1417181+r1417184.
> 
> 
> Now, (1) is a simple wrapper around (3) and (5) is a simple wrapper around (6).  
> Such pairs should have matching names.  (1) is public so can't change, so 
> I'll rename (3) to match it:

Actually (1) is new for v1.8 so we *can* change it if we want.

> 
> (3) -> 'svn_wc__db_check_root'
> 
> and (5) is named 'strictly' to distinguish it from (4), so I'll 
> leave it alone and rename (6) to match it:
> 
> (6) -> 'svn_wc__db_strictly_is_wc_root'.
> 
> That should help reduce the obfuscation a tiny bit.

- Julian