From f443c9ad383221f825b46771a2657f83cce44a06 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 3 Oct 2009 21:44:22 +0200 Subject: [PATCH] hscroll: wrap attribute access added helper functions --- src/hscroll.h | 6 ++++++ src/screen_play.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hscroll.h b/src/hscroll.h index 8b64383..cad3f17 100644 --- a/src/hscroll.h +++ b/src/hscroll.h @@ -27,6 +27,12 @@ struct hscroll { GTime t; /* GTime is equivalent to time_t */ }; +static inline void +hscroll_reset(struct hscroll *hscroll) +{ + hscroll->offset = 0; +} + char * strscroll(struct hscroll *hscroll, char *str, char *separator, unsigned width); diff --git a/src/screen_play.c b/src/screen_play.c index 3690dd3..96c2956 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -155,7 +155,7 @@ list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED must_scroll = true; if (current_song != lw->selected) { - hscroll.offset = 0; + hscroll_reset(&hscroll); current_song = lw->selected; } @@ -165,7 +165,7 @@ list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED g_free(tmp); } else - hscroll.offset = 0; + hscroll_reset(&hscroll); } #else (void)second_column; -- 2.30.2