Browse Source

centralize flushing of unfinished debug lines

wip/maildir-uid-dupes-test
Oswald Buddenhagen 14 years ago committed by Oswald Buddenhagen
parent
commit
6b3b6f12bb
  1. 1
      src/isync.h
  2. 2
      src/sync.c
  3. 24
      src/util.c

1
src/isync.h

@ -400,6 +400,7 @@ void infon( const char *, ... );
void warn( const char *, ... ); void warn( const char *, ... );
void error( const char *, ... ); void error( const char *, ... );
void sys_error( const char *, ... ); void sys_error( const char *, ... );
void flushn( void );
char *next_arg( char ** ); char *next_arg( char ** );

2
src/sync.c

@ -1733,7 +1733,7 @@ sync_bail2( sync_vars_t *svars )
free( svars->nname ); free( svars->nname );
free( svars->jname ); free( svars->jname );
free( svars->dname ); free( svars->dname );
error( "" ); flushn();
sync_deref( svars ); sync_deref( svars );
} }

24
src/util.c

@ -34,6 +34,15 @@
int DFlags, Ontty; int DFlags, Ontty;
static int need_nl; static int need_nl;
void
flushn( void )
{
if (need_nl) {
putchar( '\n' );
need_nl = 0;
}
}
void void
debug( const char *msg, ... ) debug( const char *msg, ... )
{ {
@ -96,10 +105,7 @@ warn( const char *msg, ... )
va_list va; va_list va;
if (!(DFlags & VERYQUIET)) { if (!(DFlags & VERYQUIET)) {
if (need_nl) { flushn();
putchar( '\n' );
need_nl = 0;
}
va_start( va, msg ); va_start( va, msg );
vfprintf( stderr, msg, va ); vfprintf( stderr, msg, va );
va_end( va ); va_end( va );
@ -111,10 +117,7 @@ error( const char *msg, ... )
{ {
va_list va; va_list va;
if (need_nl) { flushn();
putchar( '\n' );
need_nl = 0;
}
va_start( va, msg ); va_start( va, msg );
vfprintf( stderr, msg, va ); vfprintf( stderr, msg, va );
va_end( va ); va_end( va );
@ -126,10 +129,7 @@ sys_error( const char *msg, ... )
va_list va; va_list va;
char buf[1024]; char buf[1024];
if (need_nl) { flushn();
putchar( '\n' );
need_nl = 0;
}
va_start( va, msg ); va_start( va, msg );
if ((unsigned)vsnprintf( buf, sizeof(buf), msg, va ) >= sizeof(buf)) if ((unsigned)vsnprintf( buf, sizeof(buf), msg, va ) >= sizeof(buf))
oob(); oob();

Loading…
Cancel
Save