commit c4b4aff0a402f90ca783f1c57da4f21185791019
Author:     Oswald Buddenhagen <oswald.buddenha...@nokia.com>
AuthorDate: Mon Apr 11 10:45:46 2011 +0200
Commit:     Oswald Buddenhagen <o...@kde.org>
CommitDate: Sat Sep 1 21:15:07 2012 +0200

    centralize flushing of unfinished debug lines

 src/isync.h |    1 +
 src/sync.c  |    2 +-
 src/util.c  |   24 ++++++++++++------------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/isync.h b/src/isync.h
index c9b5798..88ee199 100644
--- a/src/isync.h
+++ b/src/isync.h
@@ -400,6 +400,7 @@ void infon( const char *, ... );
 void warn( const char *, ... );
 void error( const char *, ... );
 void sys_error( const char *, ... );
+void flushn( void );
 
 char *next_arg( char ** );
 
diff --git a/src/sync.c b/src/sync.c
index d72ae62..d8c9af8 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -1733,7 +1733,7 @@ sync_bail2( sync_vars_t *svars )
        free( svars->nname );
        free( svars->jname );
        free( svars->dname );
-       error( "" );
+       flushn();
        sync_deref( svars );
 }
 
diff --git a/src/util.c b/src/util.c
index 11ce4fc..39df03d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -35,6 +35,15 @@ int DFlags, Ontty;
 static int need_nl;
 
 void
+flushn( void )
+{
+       if (need_nl) {
+               putchar( '\n' );
+               need_nl = 0;
+       }
+}
+
+void
 debug( const char *msg, ... )
 {
        va_list va;
@@ -96,10 +105,7 @@ warn( const char *msg, ... )
        va_list va;
 
        if (!(DFlags & VERYQUIET)) {
-               if (need_nl) {
-                       putchar( '\n' );
-                       need_nl = 0;
-               }
+               flushn();
                va_start( va, msg );
                vfprintf( stderr, msg, va );
                va_end( va );
@@ -111,10 +117,7 @@ error( const char *msg, ... )
 {
        va_list va;
 
-       if (need_nl) {
-               putchar( '\n' );
-               need_nl = 0;
-       }
+       flushn();
        va_start( va, msg );
        vfprintf( stderr, msg, va );
        va_end( va );
@@ -126,10 +129,7 @@ sys_error( const char *msg, ... )
        va_list va;
        char buf[1024];
 
-       if (need_nl) {
-               putchar( '\n' );
-               need_nl = 0;
-       }
+       flushn();
        va_start( va, msg );
        if ((unsigned)vsnprintf( buf, sizeof(buf), msg, va ) >= sizeof(buf))
                oob();

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to