← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

 

Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
1. Fixed assertion failure for ().
2. Added -n as a synonym for --trailing-nl.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/208711

1. Fixed assertion failure for ().
2. Added -n as a synonym for --trailing-nl.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/208711
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'bin/zorbacmd_args.cpp'
--- bin/zorbacmd_args.cpp	2014-02-21 14:58:32 +0000
+++ bin/zorbacmd_args.cpp	2014-02-28 00:38:00 +0000
@@ -322,7 +322,7 @@
       "Trace the translator.\n\n"
 #endif /* NDEBUG */
 
-    HELP_OPT( "--trailing-nl" )
+    HELP_OPT( "--trailing-nl, -n" )
       "Print a trailing newline after the result of the query.\n\n"
 
     ////////// u //////////////////////////////////////////////////////////////
@@ -771,7 +771,7 @@
     else if ( IS_LONG_OPT( "--trace-translator" ) )
       z_props.setTraceTranslator( true );
 #endif /* NDEBUG */
-    else if ( IS_LONG_OPT( "--trailing-nl" ) )
+    else if ( IS_OPT( "--trailing-nl", "-n" ) )
       zc_props.trailing_nl_ = true;
 
     ////////// u //////////////////////////////////////////////////////////////

=== modified file 'src/runtime/csv/csv_impl.cpp'
--- src/runtime/csv/csv_impl.cpp	2014-01-20 16:52:44 +0000
+++ src/runtime/csv/csv_impl.cpp	2014-02-28 00:38:00 +0000
@@ -589,7 +589,8 @@
       while ( i->next( item ) )
         state->keys_.push_back( item );
       i->close();
-    }
+    } else
+      goto end;                         // empty sequence: we're done
   }
 
   if ( do_header ) {
@@ -601,9 +602,11 @@
         separator = true;
       line += (*key)->getStringValue();
     }
-    line += "\r\n";
-    GENV_ITEMFACTORY->createString( result, line );
-    STACK_PUSH( true, state );
+    if ( !line.empty() ) {
+      line += "\r\n";
+      GENV_ITEMFACTORY->createString( result, line );
+      STACK_PUSH( true, state );
+    }
   }
 
   if ( !state->header_item_.isNull() ) {
@@ -655,6 +658,8 @@
     GENV_ITEMFACTORY->createString( result, line );
     STACK_PUSH( true, state );
   } // while
+
+end:
   STACK_END( state );
 }
 


Follow ups