From: Karel Zak Date: Tue, 14 Nov 2023 11:46:49 +0000 (+0100) Subject: libsmartcols: accept no data for custom wrapping cells X-Git-Tag: v2.40-rc1~159 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2071997e98a8d78a235e83ba48e06023ee92b9d0;p=thirdparty%2Futil-linux.git 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 --- 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; }