List Info

Thread: Re: svn commit: r26917 - in trunk/subversion: include libsvn_subr




Re: svn commit: r26917 - in trunk/subversion: include libsvn_subr
user name
2007-10-03 21:35:03
> -----Original Message-----
> From: dlrtigris.org [mailto:dlrtigris.org] 
> Sent: Wednesday, October 03, 2007 7:11 PM
> To: svnsubversion.tigris.org
> Subject: svn commit: r26917 - in trunk/subversion:
include libsvn_subr
> 
> Author: dlr
> Date: Wed Oct  3 16:11:11 2007
> New Revision: 26917
> 
> Log:
> Set output buffering mode early during command-line 
> initialization processing.
> 
> * subversion/include/svn_cmdline.h
>   (svn_cmdline_init): Indicate that stdout and
ERROR_STREAM will have
>    their buffering mode changed to line-based and
unbuffered
>    (character-based, really), respectively.
> 
> * subversion/libsvn_subr/cmdline.c
>   Bump copyright date.  Include stdio.h.
>   (svn_cmdline_init): Call setvbuf() on stdout and
ERROR_STREAM (which
>    is typically stderr).
> 
> Suggested by: epg
>               jrepenning
> Reviewed by: epg
> 
> 
> Modified:
>    trunk/subversion/include/svn_cmdline.h
>    trunk/subversion/libsvn_subr/cmdline.c
> 
> Modified: trunk/subversion/include/svn_cmdline.h
> URL: 
> http://svn.collab.net/viewvc/svn/trunk/subversion/
include/svn_
> cmdline.h?pathrev=26917&r1=26916&r2=26917
>
============================================================
==
> ================
> --- trunk/subversion/include/svn_cmdline.h	(original)
> +++ trunk/subversion/include/svn_cmdline.h	Wed Oct  3
16:11:11 2007
>  -41,9 +41,10 
>  
>  
>  /** Set up the locale for character conversion, and
initialize APR.
> - * If a error_stream is non-null, print error messages to 
> the stream,
> - * using a progname as the program name. Return
c
EXIT_SUCCESS if
> - * successful, otherwise c EXIT_FAILURE.
> + * If a error_stream is non-NULL, print error messages to 
> the stream,
> + * using a progname as the program name.  Attempt
to set c 
> stdout to
> + * line-buffered mode, and a error_stream to
unbuffered 
> mode.  Return
> + * c EXIT_SUCCESS if successful, otherwise c
EXIT_FAILURE.
>   *
>   * note This function should be called exactly once at 
> program startup,
>   *       before calling any other APR or Subversion
functions.
> 
> Modified: trunk/subversion/libsvn_subr/cmdline.c
> URL: 
> http://svn.collab.net/viewvc/svn/trunk/subversion/
libsvn_subr/
> cmdline.c?pathrev=26917&r1=26916&r2=26917
>
============================================================
==
> ================
> --- trunk/subversion/libsvn_subr/cmdline.c	(original)
> +++ trunk/subversion/libsvn_subr/cmdline.c	Wed Oct  3
16:11:11 2007
>  -2,7 +2,7 
>   * cmdline.c :  Helpers for command-line programs.
>   *
>   * 
>
============================================================
========
> - * Copyright (c) 2000-2006 CollabNet.  All rights
reserved.
> + * Copyright (c) 2000-2007 CollabNet.  All rights
reserved.
>   *
>   * This software is licensed as described in the file
COPYING, which
>   * you should have received as part of this
distribution.  
> The terms  -18,6 +18,7 
>  
>  
>  #include <stdlib.h>             /* for atexit()
*/
> +#include <stdio.h>              /* for setvbuf()
*/
>  #include <locale.h>             /* for
setlocale() */
>  
>  #ifndef WIN32
>  -88,6 +89,12 
>    }
>  #endif
>  
> +  /* Ignore any errors encountered while attempting to
change stream
> +     buffering, as the streams should retain their
default buffering
> +     modes. */
> +  setvbuf(error_stream, NULL, _IONBF, 0); 
setvbuf(stdout, NULL, 
> + _IOLBF, 0);

On Visual Studio 2005 the _IOLBF flag is equivalent to
_IOFBF, see
htt
p://msdn2.microsoft.com/en-us/library/86cebhfs(VS.80).as
px 

This completely breaks CL on Win32 as the second setvbuf()
call with
size 0 chokes.

Right now I have this local mod in place so I can work:

   /* Ignore any errors encountered while attempting to
change stream
      buffering, as the streams should retain their default
buffering
      modes. */
   setvbuf(error_stream, NULL, _IONBF, 0);
+#ifdef WIN32
+  setvbuf(stdout, NULL, _IONBF, 0);
+#elif
   setvbuf(stdout, NULL, _IOLBF, 0);
 #endif

But I welcome any thoughts as to a better solution.

Paul

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesubversion.tigris.org
For additional commands, e-mail: dev-helpsubversion.tigris.org


Re: svn commit: r26917 - in trunk/subversion: include libsvn_subr
user name
2007-10-03 21:47:27
"Paul Burba" <pburbacollab.net> writes:

> On Visual Studio 2005 the _IOLBF flag is equivalent to
_IOFBF, see
> htt
p://msdn2.microsoft.com/en-us/library/86cebhfs(VS.80).as
px 

Last year I'd be stunned.  But I spend so much time getting
svn,
swig, and things to work on Windows these days, I'm used to
it.

> Right now I have this local mod in place so I can
work:
> 
>    /* Ignore any errors encountered while attempting to
change stream
>       buffering, as the streams should retain their
default buffering
>       modes. */
>    setvbuf(error_stream, NULL, _IONBF, 0);
> +#ifdef WIN32
> +  setvbuf(stdout, NULL, _IONBF, 0);
> +#elif
>    setvbuf(stdout, NULL, _IOLBF, 0);
>  #endif

I'm afraid it may be too expensive to turn buffering off
completely, if my experience with Windows performance in
general
(and the stock terminal emulator in specific) is any
indication.
So, it's probably best to change stdout only in #ifndef
WIN32.

> But I welcome any thoughts as to a better solution.

That's just a thought; I'll defer to people with more
Windows
experience.

-- 
Eric Gillespie <*> epgpretzelnet.org

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesubversion.tigris.org
For additional commands, e-mail: dev-helpsubversion.tigris.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )