1 Star 0 Fork 48

maqi/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0133-format-table-add-calls-to-query-the-data-in-a-specif.patch 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:59 . import systemd-239-29.el8.src.rpm
From c4f60df10a2716c94d30462a118f60d916d537a2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 9 Nov 2018 11:38:12 +0100
Subject: [PATCH] format-table: add calls to query the data in a specific cell
(cherry picked from commit 62d99b39709f903f8a66a9aae757deb5546a53eb)
Related: #1689832
---
src/basic/format-table.c | 22 ++++++++++++++++++++++
src/basic/format-table.h | 3 +++
2 files changed, 25 insertions(+)
diff --git a/src/basic/format-table.c b/src/basic/format-table.c
index 3fcb97475c..0a1777e9a2 100644
--- a/src/basic/format-table.c
+++ b/src/basic/format-table.c
@@ -1438,3 +1438,25 @@ TableCell *table_get_cell(Table *t, size_t row, size_t column) {
return TABLE_INDEX_TO_CELL(i);
}
+
+const void *table_get(Table *t, TableCell *cell) {
+ TableData *d;
+
+ assert(t);
+
+ d = table_get_data(t, cell);
+ if (!d)
+ return NULL;
+
+ return d->data;
+}
+
+const void* table_get_at(Table *t, size_t row, size_t column) {
+ TableCell *cell;
+
+ cell = table_get_cell(t, row, column);
+ if (!cell)
+ return NULL;
+
+ return table_get(t, cell);
+}
diff --git a/src/basic/format-table.h b/src/basic/format-table.h
index 40fea79f78..a2bb2e0846 100644
--- a/src/basic/format-table.h
+++ b/src/basic/format-table.h
@@ -68,3 +68,6 @@ 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);
+
+const void *table_get(Table *t, TableCell *cell);
+const void *table_get_at(Table *t, size_t row, size_t column);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/maqi77/systemd.git
git@gitee.com:maqi77/systemd.git
maqi77
systemd
systemd
a8

搜索帮助