[goffice] Minor cleanup.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Minor cleanup.
- Date: Sat, 26 Sep 2020 20:36:48 +0000 (UTC)
commit a66fc0ed929384cc5115a1cc2b3ca4f0fb04afef
Author: Morten Welinder <terra gnome org>
Date: Sat Sep 26 16:36:35 2020 -0400
Minor cleanup.
ChangeLog | 1 +
goffice/graph/gog-axis-line.c | 19 ++++++++++---------
2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8b279587..ae068b5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
* goffice/graph/gog-axis-line.c (gog_axis_line_update_ticks): Zero
tick count when we dispose of ticks. Fixes Gnumeric #524.
+ (gog_axis_line_discard_ticks): Factor this repeated segment out.
2020-08-29 Morten Welinder <terra gnome org>
diff --git a/goffice/graph/gog-axis-line.c b/goffice/graph/gog-axis-line.c
index d97a2680..d759bca1 100644
--- a/goffice/graph/gog-axis-line.c
+++ b/goffice/graph/gog-axis-line.c
@@ -2514,9 +2514,8 @@ axis_line_format_value (GogAxisLine *line, double val, GOString **str)
}
static void
-gog_axis_line_update_ticks (GogAxisLine *line)
+gog_axis_line_discard_ticks (GogAxisLine *line)
{
- GODataVector *pos, *labels;
if (line->ticks != NULL) {
unsigned i;
for (i = 0; i < line->tick_nbr; i++)
@@ -2526,6 +2525,14 @@ gog_axis_line_update_ticks (GogAxisLine *line)
}
line->ticks = NULL;
line->tick_nbr = 0;
+}
+
+static void
+gog_axis_line_update_ticks (GogAxisLine *line)
+{
+ GODataVector *pos, *labels;
+
+ gog_axis_line_discard_ticks (line);
pos = GO_DATA_VECTOR (line->custom_ticks[0].data);
labels = GO_DATA_VECTOR (line->custom_ticks[1].data);
if (pos != NULL && go_data_has_value (GO_DATA (pos)) && go_data_is_varying_uniformly (GO_DATA (pos)))
{
@@ -2670,13 +2677,7 @@ gog_axis_line_finalize (GObject *obj)
{
GogAxisLine *line = GOG_AXIS_LINE (obj);
- if (line->ticks != NULL) {
- unsigned i;
- for (i = 0; i < line->tick_nbr; i++)
- go_string_unref (line->ticks[i].str);
-
- g_free (line->ticks);
- }
+ gog_axis_line_discard_ticks (line);
go_format_unref (line->assigned_format);
go_format_unref (line->format);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]