[vte] draw: Remove unnecessary out param checks
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] draw: Remove unnecessary out param checks
- Date: Mon, 1 Jun 2020 20:50:37 +0000 (UTC)
commit 012131e92b290a6c80becc4fa234570be5592e25
Author: Christian Persch <chpe src gnome org>
Date: Mon Jun 1 22:48:43 2020 +0200
draw: Remove unnecessary out param checks
We can just always pass the param even if unused, since this
is used only internally and in a few places.
src/vte.cc | 6 +++---
src/vtedraw.cc | 26 ++++++++++----------------
src/vtedraw.hh | 4 ++--
3 files changed, 15 insertions(+), 21 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index a161c184..27acc6ac 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -9049,7 +9049,7 @@ Terminal::paint_cursor()
if (cell && cell->c != 0 && cell->c != ' ' && cell->c != '\t') {
int l, r;
- m_draw.get_char_edges(cell->c, cell->attr.columns(), style, &l, &r);
+ m_draw.get_char_edges(cell->c, cell->attr.columns(), style, l, r);
left = MIN(left, l);
right = MAX(right, r);
}
@@ -9067,8 +9067,8 @@ Terminal::paint_cursor()
cursor_width = item.columns * width;
if (cell && cell->c != 0 && cell->c != ' ' && cell->c != '\t') {
- int r;
- m_draw.get_char_edges(cell->c, cell->attr.columns(), style, NULL, &r);
+ int l, r;
+ m_draw.get_char_edges(cell->c, cell->attr.columns(), style, l /* unused */,
r);
cursor_width = MAX(cursor_width, r);
}
diff --git a/src/vtedraw.cc b/src/vtedraw.cc
index 812d7932..277a217c 100644
--- a/src/vtedraw.cc
+++ b/src/vtedraw.cc
@@ -953,24 +953,20 @@ void
DrawingContext::get_char_edges(vteunistr c,
int columns,
guint style,
- int* left,
- int* right)
+ int& left,
+ int& right)
{
if (G_UNLIKELY(unichar_is_local_graphic (c))) {
- if (left)
- *left = 0;
- if (right)
- *right = m_cell_width * columns;
+ left = 0;
+ right = m_cell_width * columns;
return;
}
int l, w, normal_width, fits_width;
if (G_UNLIKELY (m_fonts[VTE_DRAW_NORMAL] == nullptr)) {
- if (left)
- *left = 0;
- if (right)
- *right = 0;
+ left = 0;
+ right = 0;
return;
}
@@ -991,10 +987,8 @@ DrawingContext::get_char_edges(vteunistr c,
l = 0;
}
- if (left)
- *left = l;
- if (right)
- *right = l + w;
+ left = l;
+ right = l + w;
}
/* pixman data must have stride 0 mod 4 */
@@ -2117,9 +2111,9 @@ DrawingContext::draw_text_internal(struct _vte_draw_text_request *requests,
auto uinfo = font->get_unistr_info(c);
union unistr_font_info *ufi = &uinfo->ufi;
- int x, y;
+ int x, y, ye;
- get_char_edges(c, requests[i].columns, style, &x, nullptr);
+ get_char_edges(c, requests[i].columns, style, x, ye /* unused */);
x += requests[i].x;
/* Bold/italic versions might have different ascents. In order to align their
* baselines, we offset by the normal font's ascent here. (Bug 137.) */
diff --git a/src/vtedraw.hh b/src/vtedraw.hh
index 3ff72761..e1228a0a 100644
--- a/src/vtedraw.hh
+++ b/src/vtedraw.hh
@@ -84,8 +84,8 @@ public:
void get_char_edges(vteunistr c,
int columns,
guint style,
- int* left,
- int* right);
+ int& left,
+ int& right);
bool has_bold(guint style);
void draw_text(struct _vte_draw_text_request *requests,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]