You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Karl Fogel <kf...@newton.ch.collab.net> on 2002/04/12 17:03:50 UTC

Re: svn commit: rev 1677 - trunk/subversion/libsvn_wc

cmpilato@tigris.org writes:
> Author: cmpilato
> Date: 2002-04-12 03:14 GMT
> New Revision: 1677
> 
> Modified:
>    trunk/subversion/libsvn_wc/translate.c
> Log:
> * subversion/libsvn_wc/translate.c
>   (expand_keyword): Use apr_strnatcasecmp instead of strcasecmp.

Hmmm -- what was the reason for the switch?

We're just testing to see if the strings are "the same" or not; if the
value returned by str[nat]casecmp is non-zero, we don't care if it's
negative or positive, right?  The fact that it's non-zero is all that
matters.  Is there some way that natural order comparison will help us
here?

-K


> Modified: trunk/subversion/libsvn_wc/translate.c
> ==============================================================================
> --- trunk/subversion/libsvn_wc/translate.c	(original)
> +++ trunk/subversion/libsvn_wc/translate.c	Thu Apr 11 22:14:19 2002
> @@ -897,7 +897,7 @@
>  {
>    *is_valid_p = TRUE;
>  
> -  /* Using strcasecmp() to accept downcased short versions of
> +  /* Using apr_strnatcasecmp() to accept downcased short versions of
>     * keywords.  Note that this doesn't apply to the strings being
>     * expanded in the file -- rather, it's so users can do
>     *
> @@ -908,7 +908,7 @@
>     */
>  
>    if ((! strcmp (keyword, SVN_KEYWORD_REVISION_LONG))
> -      || (! strcasecmp (keyword, SVN_KEYWORD_REVISION_SHORT)))
> +      || (! apr_strnatcasecmp (keyword, SVN_KEYWORD_REVISION_SHORT)))
>      {
>        if ((entry) && (entry->cmt_rev))
>          keywords->revision = svn_string_createf (pool, "%ld", entry->cmt_rev);
> @@ -919,7 +919,7 @@
>          keywords->revision = svn_string_create ("", pool);
>      }
>    else if ((! strcmp (keyword, SVN_KEYWORD_DATE_LONG))
> -           || (! strcasecmp (keyword, SVN_KEYWORD_DATE_SHORT)))
> +           || (! apr_strnatcasecmp (keyword, SVN_KEYWORD_DATE_SHORT)))
>      {
>        if (entry && (entry->cmt_date))
>          keywords->date = svn_wc__friendly_date 
> @@ -928,7 +928,7 @@
>          keywords->date = svn_string_create ("", pool);
>      }
>    else if ((! strcmp (keyword, SVN_KEYWORD_AUTHOR_LONG))
> -           || (! strcasecmp (keyword, SVN_KEYWORD_AUTHOR_SHORT)))
> +           || (! apr_strnatcasecmp (keyword, SVN_KEYWORD_AUTHOR_SHORT)))
>      {
>        if (entry && (entry->cmt_author))
>          keywords->author = svn_string_create_from_buf (entry->cmt_author, pool);
> @@ -936,7 +936,7 @@
>          keywords->author = svn_string_create ("", pool);
>      }
>    else if ((! strcmp (keyword, SVN_KEYWORD_URL_LONG))
> -           || (! strcasecmp (keyword, SVN_KEYWORD_URL_SHORT)))
> +           || (! apr_strnatcasecmp (keyword, SVN_KEYWORD_URL_SHORT)))
>      {
>        if (entry && (entry->url))
>          keywords->url = svn_string_create_from_buf (entry->url, pool);
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-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: rev 1677 - trunk/subversion/libsvn_wc

Posted by cm...@collab.net.
Karl Fogel <kf...@newton.ch.collab.net> writes:

> cmpilato@collab.net writes:
> > > Hmmm -- what was the reason for the switch?
> > 
> > ANSI-C-ness. :-)  I got a build error on Win32.
> 
> Hmmm.  apr_general.h is supposed to provide that for us, I thought; I
> wonder why it's not working for Win32...
> 
>    /**
>     * A couple of prototypes for functions in case some platform doesn't 
>     * have it
>     */
>    #if <!APR_HAVE_STRCASECMP> && <APR_HAVE_STRICMP> 
>    #define strcasecmp<s1, s2> stricmp<s1, s2>
>    #elif <!APR_HAVE_STRCASECMP>
>    int strcasecmp<const char *a, const char *b>;
>    #endif
> 
> ?

That's a good question.  apr.hw (which is copied to apr.h) defines
APR_HAVE_STRICMP as `1' for all Windows platforms except WinCE.  Hm...

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

Re: svn commit: rev 1677 - trunk/subversion/libsvn_wc

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
cmpilato@collab.net writes:
> > Hmmm -- what was the reason for the switch?
> 
> ANSI-C-ness. :-)  I got a build error on Win32.

Hmmm.  apr_general.h is supposed to provide that for us, I thought; I
wonder why it's not working for Win32...

   /**
    * A couple of prototypes for functions in case some platform doesn't 
    * have it
    */
   #if <!APR_HAVE_STRCASECMP> && <APR_HAVE_STRICMP> 
   #define strcasecmp<s1, s2> stricmp<s1, s2>
   #elif <!APR_HAVE_STRCASECMP>
   int strcasecmp<const char *a, const char *b>;
   #endif

?

-Karl

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

Re: svn commit: rev 1677 - trunk/subversion/libsvn_wc

Posted by cm...@collab.net.
Karl Fogel <kf...@newton.ch.collab.net> writes:

> Hmmm -- what was the reason for the switch?

ANSI-C-ness. :-)  I got a build error on Win32.

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