teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0137-format-table-never-try-to-reuse-cells-that-have-colo.patch

ff6046
From a064e883c7cc28b8d561a7fea56b139d8e7d2286 Mon Sep 17 00:00:00 2001
ff6046
From: Lennart Poettering <lennart@poettering.net>
ff6046
Date: Mon, 3 Dec 2018 21:39:39 +0100
ff6046
Subject: [PATCH] format-table: never try to reuse cells that have
ff6046
 color/url/uppercase set
ff6046
ff6046
The table cell reusing code is supposed to be an internal memory
ff6046
optimization, and not more. This means behaviour should be the same as
ff6046
if we wouldn't reuse cells.
ff6046
ff6046
(cherry picked from commit 94a80afed42a8b36d69a229bf44ba690f8f59a78)
ff6046
ff6046
Related: #1689832
ff6046
---
ff6046
 src/basic/format-table.c | 8 ++++++++
ff6046
 1 file changed, 8 insertions(+)
ff6046
ff6046
diff --git a/src/basic/format-table.c b/src/basic/format-table.c
ff6046
index fe2201ee5f..844b92f41c 100644
ff6046
--- a/src/basic/format-table.c
ff6046
+++ b/src/basic/format-table.c
ff6046
@@ -286,6 +286,14 @@ static bool table_data_matches(
ff6046
         if (d->ellipsize_percent != ellipsize_percent)
ff6046
                 return false;
ff6046
 
ff6046
+        /* If a color/url/uppercase flag is set, refuse to merge */
ff6046
+        if (d->color)
ff6046
+                return false;
ff6046
+        if (d->url)
ff6046
+                return false;
ff6046
+        if (d->uppercase)
ff6046
+                return false;
ff6046
+
ff6046
         k = table_data_size(type, data);
ff6046
         l = table_data_size(d->type, d->data);
ff6046