From 2071997e98a8d78a235e83ba48e06023ee92b9d0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 14 Nov 2023 12:46:49 +0100 Subject: [PATCH] libsmartcols: accept no data for custom wrapping cells Don't re-use previously used 'rc' variable, otherwise empty cell will be interpreted as error. Signed-off-by: Karel Zak --- libsmartcols/src/print.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libsmartcols/src/print.c b/libsmartcols/src/print.c index d1e2274517..16c2436b37 100644 --- a/libsmartcols/src/print.c +++ b/libsmartcols/src/print.c @@ -712,9 +712,11 @@ notree: rc = cal ? scols_column_greatest_wrap(cl, ce, &x) : scols_column_next_wrap(cl, ce, &x); + /* rc: error: <0; nodata: 1; success: 0 */ if (rc < 0) - return rc; + goto done; data = x; + rc = 0; if (data && *data) datasiz = strlen(data); if (data && datasiz) @@ -761,6 +763,9 @@ notree: /* reset wrapping after greatest chunk calculation */ if (cal && scols_column_is_wrap(cl)) scols_column_reset_wrap(cl); + +done: + DBG(COL, ul_debugobj(cl, "__cursor_to_buffer rc=%d", rc)); return rc; } -- 2.47.2