css: Some inlining
authorMatthias Clasen <mclasen@redhat.com>
Thu, 12 Jan 2023 02:18:36 +0000 (21:18 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 12 Jan 2023 05:11:10 +0000 (00:11 -0500)
gtk/css/gtkcsslocation.c [deleted file]
gtk/css/gtkcsslocationprivate.h
gtk/css/gtkcsstokenizer.c
gtk/css/meson.build

diff --git a/gtk/css/gtkcsslocation.c b/gtk/css/gtkcsslocation.c
deleted file mode 100644 (file)
index 41725ad..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* GSK - The GIMP Toolkit
- * Copyright (C) 2019 Benjamin Otte <otte@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#include "gtkcsslocationprivate.h"
-
-/**
- * GtkCssLocation:
- * @bytes: number of bytes parsed since the beginning
- * @chars: number of characters parsed since the beginning
- * @lines: number of full lines that have been parsed. If you want to
- *   display this as a line number, you need to add 1 to this.
- * @line_bytes: Number of bytes parsed since the last line break
- * @line_chars: Number of characters parsed since the last line break
- *
- * Represents a location in a file or other source of data parsed
- * by the CSS engine.
- *
- * The @bytes and @line_bytes offsets are meant to be used to
- * programmatically match data. The @lines and @line_chars offsets
- * can be used for printing the location in a file.
- *
- * Note that the @lines parameter starts from 0 and is increased
- * whenever a CSS line break is encountered. (CSS defines the C character
- * sequences "\r\n", "\r", "\n" and "\f" as newlines.)
- * If your document uses different rules for line breaking, you might want
- * run into problems here.
- */
-
-void
-gtk_css_location_init (GtkCssLocation *location)
-{
-  memset (location, 0, sizeof (GtkCssLocation));
-}
-
-void
-gtk_css_location_advance (GtkCssLocation *location,
-                          gsize           bytes,
-                          gsize           chars)
-{
-  location->bytes += bytes;
-  location->chars += chars;
-  location->line_bytes += bytes;
-  location->line_chars += chars;
-}
-
-void
-gtk_css_location_advance_newline (GtkCssLocation *location,
-                                  gboolean        is_windows)
-{
-  gtk_css_location_advance (location, is_windows ? 2 : 1, is_windows ? 2 : 1);
-
-  location->lines++;
-  location->line_bytes = 0;
-  location->line_chars = 0;
-}
-
index 46ed3c80562098c85f3ee1276d7fd30df978e51e..89ff0e979e0b9e37d014afda3318584d0aaa29d0 100644 (file)
 
 G_BEGIN_DECLS
 
-void                    gtk_css_location_init                   (GtkCssLocation         *location);
-
-void                    gtk_css_location_advance                (GtkCssLocation         *location,
-                                                                 gsize                   bytes,
-                                                                 gsize                   chars);
-void                    gtk_css_location_advance_newline        (GtkCssLocation         *location,
-                                                                 gboolean                is_windows);
+static inline void
+gtk_css_location_init (GtkCssLocation *location)
+{
+  memset (location, 0, sizeof (GtkCssLocation));
+}
+
+static inline void
+gtk_css_location_advance (GtkCssLocation *location,
+                          gsize           bytes,
+                          gsize           chars)
+{
+  location->bytes += bytes;
+  location->chars += chars;
+  location->line_bytes += bytes;
+  location->line_chars += chars;
+}
+
+static inline void
+gtk_css_location_advance_newline (GtkCssLocation *location,
+                                  gboolean        is_windows)
+{
+  location->bytes += is_windows ? 2 : 1;
+  location->chars += is_windows ? 2 : 1;
+  location->line_bytes = 0;
+  location->line_chars = 0;
+  location->lines++;
+}
 
 G_END_DECLS
 
index 4d405539e63c9faa88f64324cc9b43fc4a81b6dd..262f52a3cda57949862fa9bde17745194feffca0 100644 (file)
@@ -630,7 +630,7 @@ gtk_css_tokenizer_parse_error (GError     **error,
   va_end (args);
 }
 
-static gboolean
+static inline gboolean
 is_newline (char c)
 {
   return c == '\n'
@@ -638,7 +638,7 @@ is_newline (char c)
       || c == '\f';
 }
 
-static gboolean
+static inline gboolean
 is_whitespace (char c)
 {
   return is_newline (c)
@@ -646,13 +646,13 @@ is_whitespace (char c)
       || c == ' ';
 }
 
-static gboolean
+static inline gboolean
 is_multibyte (char c)
 {
   return c & 0x80;
 }
 
-static gboolean
+static inline gboolean
 is_name_start (char c)
 {
    return is_multibyte (c)
@@ -660,7 +660,7 @@ is_name_start (char c)
        || c == '_';
 }
 
-static gboolean
+static inline gboolean
 is_name (char c)
 {
   return is_name_start (c)
@@ -668,7 +668,7 @@ is_name (char c)
       || c == '-';
 }
 
-static gboolean
+static inline gboolean
 is_non_printable (char c)
 {
   return (c >= 0 && c <= 0x08)
@@ -678,7 +678,7 @@ is_non_printable (char c)
       || c == 0x7F;
 }
 
-static gboolean
+static inline gboolean
 is_valid_escape (const char *data,
                  const char *end)
 {
@@ -703,7 +703,7 @@ gtk_css_tokenizer_remaining (GtkCssTokenizer *tokenizer)
   return tokenizer->end - tokenizer->data;
 }
 
-static gboolean
+static inline gboolean
 gtk_css_tokenizer_has_valid_escape (GtkCssTokenizer *tokenizer)
 {
   return is_valid_escape (tokenizer->data, tokenizer->end);
index 2785f413745523975901230f607a93c259846b9e..bf083f693e4ea1c39047fb1df1520c848ace8603 100644 (file)
@@ -1,5 +1,4 @@
 gtk_css_public_sources = files([
-  'gtkcsslocation.c',
   'gtkcsserror.c',
   'gtkcsssection.c',
 ])