1 Star 0 Fork 50

杨枝甘露瑞纳冰/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0131-format-table-add-an-API-for-getting-the-cell-at-a-sp.patch 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:59 . import systemd-239-29.el8.src.rpm
From ecc27a3bf5935cebc63aa4e3b650861d1f0ef97f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 8 Nov 2018 21:21:09 +0100
Subject: [PATCH] format-table: add an API for getting the cell at a specific
row/column
(cherry picked from commit 9314ead7853a1479fc60eb2ae7e3d0a77b7eba7c)
Related: #1689832
---
src/basic/format-table.c | 15 +++++++++++++++
src/basic/format-table.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/src/basic/format-table.c b/src/basic/format-table.c
index 302642d748..809a4be284 100644
--- a/src/basic/format-table.c
+++ b/src/basic/format-table.c
@@ -1416,3 +1416,18 @@ int table_set_reverse(Table *t, size_t column, bool b) {
t->reverse_map[column] = b;
return 0;
}
+
+TableCell *table_get_cell(Table *t, size_t row, size_t column) {
+ size_t i;
+
+ assert(t);
+
+ if (column >= t->n_columns)
+ return NULL;
+
+ i = row * t->n_columns + column;
+ if (i >= t->n_cells)
+ return NULL;
+
+ return TABLE_INDEX_TO_CELL(i);
+}
diff --git a/src/basic/format-table.h b/src/basic/format-table.h
index 4273c8c49b..40fea79f78 100644
--- a/src/basic/format-table.h
+++ b/src/basic/format-table.h
@@ -66,3 +66,5 @@ static inline TableCell* TABLE_HEADER_CELL(size_t i) {
size_t table_get_rows(Table *t);
size_t table_get_columns(Table *t);
+
+TableCell *table_get_cell(Table *t, size_t row, size_t column);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yummypeng/systemd.git
git@gitee.com:yummypeng/systemd.git
yummypeng
systemd
systemd
a8

搜索帮助