You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2002/03/19 22:35:11 UTC

Re: svn commit: rev 1560 - trunk/subversion/clients/cmdline

Just as a funny note, I had updated print_long_format() to optimize out the
status->entry check *exactly* the same as Mike (minus format tidbits). When
I updated after his change, I had major conflicts to resolve, but it was
also easy since we had done the same refactoring :-)

However, I did the refactor without using a pool, so I checked in that part
of the change...

Cheers,
-g

[ my initial look into this section was because the code clips long user
  names, such as "anonymous", which I don't think it should do ]

On Tue, Mar 19, 2002 at 04:19:03PM -0600, gstein@tigris.org wrote:
> Author: gstein
> Date: 2002-03-19 22:19 GMT
> New Revision: 1560
> 
> Modified:
>    trunk/subversion/clients/cmdline/status.c
> Log:
> Remove pool usage in status printing to prevent memory growth.
> 
> * cmdline/status.c (print_long_format): remove pool argument, use a
>     buffer for serializing the revision number, and revamp the logic
>     for filling in and using the revision string.
>   (svn_cl__print_status_list): don't pass a pool to print_long_format
> 
> 
> Modified: trunk/subversion/clients/cmdline/status.c
> ==============================================================================
> --- trunk/subversion/clients/cmdline/status.c	(original)
> +++ trunk/subversion/clients/cmdline/status.c	Tue Mar 19 16:19:03 2002
> @@ -146,8 +146,7 @@
>  static void 
>  print_long_format (const char *path,
>                     svn_boolean_t show_last_committed,
> -                   svn_wc_status_t *status,
> -                   apr_pool_t *pool)
> +                   svn_wc_status_t *status)
>  {
>    char str_status[5];
>    char str_rev[7];
> @@ -171,17 +170,23 @@
>    else
>      local_rev = SVN_INVALID_REVNUM;
>  
> -  /* If we are printing the last-committed stuff ... */
> -  if ((show_last_committed) && (status->entry))
> +  if (show_last_committed && status->entry)
>      {
> -      svn_stringbuf_t *revstr = NULL, *s_author = NULL;
> +      char revbuf[20];
> +      const char *revstr = revbuf;
> +      svn_stringbuf_t *s_author;
>        
>        s_author = status->entry->cmt_author;
>        if (SVN_IS_VALID_REVNUM (status->entry->cmt_rev))
> -        revstr = svn_stringbuf_createf (pool, "%ld", status->entry->cmt_rev);
> -
> +        sprintf(revbuf, "%ld", status->entry->cmt_rev);
> +      else
> +        revstr = "    ? ";
> +
> +      /* ### we shouldn't clip the revstr and author, but that implies a
> +         ### variable length 'last_committed' which means an allocation,
> +         ### which means a pool, ...  */
>        sprintf (last_committed, "%6.6s   %8.8s   ",
> -               revstr ? revstr->data : "    ? ",
> +               revstr,
>                 s_author ? s_author->data : "      ? ");
>      }
>    else
> @@ -244,7 +249,7 @@
>          continue;
>  
>        if (detailed)
> -        print_long_format (item->key, show_last_committed, status, pool);
> +        print_long_format (item->key, show_last_committed, status);
>        else
>          print_short_format (item->key, status);
>      }
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org

-- 
Greg Stein, http://www.lyra.org/

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