From e47fac5252ccf1ee874a8e8a5edc5e83754b0e46 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 10 Apr 2002 08:43:22 +0000 Subject: [PATCH] Fixes. * lists.c (list_print): Do not output trailing whitespace. This change is intended to make writing tests easier. [SVN r13425] --- historic/jam/src/lists.c | 8 ++++++-- jam_src/lists.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/historic/jam/src/lists.c b/historic/jam/src/lists.c index b8d2dae79..c75c544e8 100644 --- a/historic/jam/src/lists.c +++ b/historic/jam/src/lists.c @@ -172,8 +172,12 @@ LIST * list_pop_front( LIST *l ) void list_print( LIST *l ) { - for( ; l; l = list_next( l ) ) - printf( "%s ", l->string ); + LIST *p = 0; + for( ; l; p = l, l = list_next( l ) ) + if ( p ) + printf( "%s ", p->string ); + if ( p ) + printf( "%s", p->string ); } /* diff --git a/jam_src/lists.c b/jam_src/lists.c index b8d2dae79..c75c544e8 100644 --- a/jam_src/lists.c +++ b/jam_src/lists.c @@ -172,8 +172,12 @@ LIST * list_pop_front( LIST *l ) void list_print( LIST *l ) { - for( ; l; l = list_next( l ) ) - printf( "%s ", l->string ); + LIST *p = 0; + for( ; l; p = l, l = list_next( l ) ) + if ( p ) + printf( "%s ", p->string ); + if ( p ) + printf( "%s", p->string ); } /*