[gtk/wip/baedert/for-master] css: Make some local variables const



commit 0a9af4f30cd7eea124a0ad5e77002fefaa51fe6b
Author: Timm Bäder <mail baedert org>
Date:   Tue Feb 4 10:17:15 2020 +0100

    css: Make some local variables const

 gtk/gtkcssstaticstyle.c | 22 +++++++++++-----------
 gtk/gtkcssstyle.c       |  4 ++--
 gtk/gtkrenderborder.c   |  4 +---
 3 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index 62194d4bdc..5a9336ce79 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -46,7 +46,7 @@ static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
                                                 GtkCssValue       *specified,
                                                 GtkCssSection     *section);
 
-static int core_props[] = {
+static const int core_props[] = {
   GTK_CSS_PROPERTY_COLOR,
   GTK_CSS_PROPERTY_DPI,
   GTK_CSS_PROPERTY_FONT_SIZE,
@@ -54,7 +54,7 @@ static int core_props[] = {
   GTK_CSS_PROPERTY_ICON_PALETTE
 };
 
-static int background_props[] = {
+static const int background_props[] = {
   GTK_CSS_PROPERTY_BACKGROUND_COLOR,
   GTK_CSS_PROPERTY_BOX_SHADOW,
   GTK_CSS_PROPERTY_BACKGROUND_CLIP,
@@ -66,7 +66,7 @@ static int background_props[] = {
   GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE
 };
 
-static int border_props[] = {
+static const int border_props[] = {
   GTK_CSS_PROPERTY_BORDER_TOP_STYLE,
   GTK_CSS_PROPERTY_BORDER_TOP_WIDTH,
   GTK_CSS_PROPERTY_BORDER_LEFT_STYLE,
@@ -89,13 +89,13 @@ static int border_props[] = {
   GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH
 };
 
-static int icon_props[] = {
+static const int icon_props[] = {
   GTK_CSS_PROPERTY_ICON_SIZE,
   GTK_CSS_PROPERTY_ICON_SHADOW,
   GTK_CSS_PROPERTY_ICON_STYLE,
 };
 
-static int outline_props[] = {
+static const int outline_props[] = {
   GTK_CSS_PROPERTY_OUTLINE_STYLE,
   GTK_CSS_PROPERTY_OUTLINE_WIDTH,
   GTK_CSS_PROPERTY_OUTLINE_OFFSET,
@@ -106,7 +106,7 @@ static int outline_props[] = {
   GTK_CSS_PROPERTY_OUTLINE_COLOR,
 };
 
-static int font_props[] = {
+static const int font_props[] = {
   GTK_CSS_PROPERTY_FONT_FAMILY,
   GTK_CSS_PROPERTY_FONT_STYLE,
   GTK_CSS_PROPERTY_FONT_WEIGHT,
@@ -118,7 +118,7 @@ static int font_props[] = {
   GTK_CSS_PROPERTY_FONT_FEATURE_SETTINGS,
   GTK_CSS_PROPERTY_FONT_VARIATION_SETTINGS,
 };
-static int font_variant_props[] = {
+static const int font_variant_props[] = {
   GTK_CSS_PROPERTY_TEXT_DECORATION_LINE,
   GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR,
   GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE,
@@ -131,7 +131,7 @@ static int font_variant_props[] = {
   GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN,
 };
 
-static int animation_props[] = {
+static const int animation_props[] = {
   GTK_CSS_PROPERTY_ANIMATION_NAME,
   GTK_CSS_PROPERTY_ANIMATION_DURATION,
   GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION,
@@ -142,14 +142,14 @@ static int animation_props[] = {
   GTK_CSS_PROPERTY_ANIMATION_FILL_MODE,
 };
 
-static int transition_props[] = {
+static const int transition_props[] = {
   GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
   GTK_CSS_PROPERTY_TRANSITION_DURATION,
   GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
   GTK_CSS_PROPERTY_TRANSITION_DELAY,
 };
 
-static int size_props[] = {
+static const int size_props[] = {
   GTK_CSS_PROPERTY_MARGIN_TOP,
   GTK_CSS_PROPERTY_MARGIN_LEFT,
   GTK_CSS_PROPERTY_MARGIN_BOTTOM,
@@ -163,7 +163,7 @@ static int size_props[] = {
   GTK_CSS_PROPERTY_MIN_HEIGHT,
 };
 
-static int other_props[] = {
+static const int other_props[] = {
   GTK_CSS_PROPERTY_ICON_SOURCE,
   GTK_CSS_PROPERTY_ICON_TRANSFORM,
   GTK_CSS_PROPERTY_ICON_FILTER,
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index 5707b0eb55..d95e22dd95 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -688,7 +688,7 @@ gtk_css_style_get_pango_font (GtkCssStyle *style)
 
 /* Refcounted value structs */
 
-static int values_size[] = {
+static const int values_size[] = {
   sizeof (GtkCssCoreValues),
   sizeof (GtkCssCoreValues),
   sizeof (GtkCssBackgroundValues),
@@ -780,5 +780,5 @@ gtk_css_values_new (GtkCssValuesType type)
   values->ref_count = 1;
   values->type = type - (type % 2);
 
-  return values;  
+  return values;
 }
diff --git a/gtk/gtkrenderborder.c b/gtk/gtkrenderborder.c
index 78a2cacea7..a137d0814c 100644
--- a/gtk/gtkrenderborder.c
+++ b/gtk/gtkrenderborder.c
@@ -651,12 +651,10 @@ void
 gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
                                GtkSnapshot *snapshot)
 {
-  GtkCssBorderValues *border;
+  const GtkCssBorderValues *border = boxes->style->border;
   GtkBorderImage border_image;
   float border_width[4];
 
-  border = boxes->style->border;
-
   if (border->base.type == GTK_CSS_BORDER_INITIAL_VALUES)
     return;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]