1 Star 0 Fork 49

AliOS Auto/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0127-format-table-before-outputting-a-color-check-if-colo.patch 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:59 . import systemd-239-29.el8.src.rpm
From 02b72c15a53f694f65a377206fba478db91432cd Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 6 Nov 2018 18:37:21 +0100
Subject: [PATCH] format-table: before outputting a color, check if colors are
available
This is in many cases redundant, as a similar check is done by various
callers already, but in other cases (where we read the color from a
static table for example), it's nice to let the color check be done by
the table code itself, and since it doesn't hurt in the other cases just
do it again.
(cherry picked from commit a22318e55492af721879d8692ed039144696bb08)
Related: #1689832
---
src/basic/format-table.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/basic/format-table.c b/src/basic/format-table.c
index ac5d66eda2..17be7285cd 100644
--- a/src/basic/format-table.c
+++ b/src/basic/format-table.c
@@ -1255,13 +1255,13 @@ int table_print(Table *t, FILE *f) {
if (j > 0)
fputc(' ', f); /* column separator */
- if (d->color)
+ if (d->color && colors_enabled())
fputs(d->color, f);
fputs(field, f);
- if (d->color)
- fputs(ansi_normal(), f);
+ if (d->color && colors_enabled())
+ fputs(ANSI_NORMAL, f);
}
fputc('\n', f);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/banma-autoos/systemd.git
git@gitee.com:banma-autoos/systemd.git
banma-autoos
systemd
systemd
a8

搜索帮助

0d507c66 1850385 C8b1a773 1850385