[gtk/wip/otte/json: 5/21] jsonparser: Remove line number tracking




commit de1af44ef298ce1185ef7a583274113cadd8a803
Author: Benjamin Otte <otte redhat com>
Date:   Sun Nov 28 17:22:45 2021 +0100

    jsonparser: Remove line number tracking
    
    We can parse the document manually if we're interested.

 gtk/json/gtkjsonparser.c | 22 ----------------------
 1 file changed, 22 deletions(-)
---
diff --git a/gtk/json/gtkjsonparser.c b/gtk/json/gtkjsonparser.c
index 79d8352125..d0ca31c93f 100644
--- a/gtk/json/gtkjsonparser.c
+++ b/gtk/json/gtkjsonparser.c
@@ -29,9 +29,6 @@ struct _GtkJsonReader
 {
   const guchar *data;
   const guchar *end;
-
-  gsize lines;
-  const guchar *line_start;
 };
 
 typedef enum {
@@ -131,8 +128,6 @@ gtk_json_reader_init (GtkJsonReader *reader,
 {
   reader->data = data;
   reader->end = data + size;
-  reader->lines = 0;
-  reader->line_start = data;
 }
 
 static gboolean
@@ -158,16 +153,9 @@ gtk_json_reader_skip_whitespace (GtkJsonReader *reader)
         {
         case ' ':
         case '\t':
-          reader->data++;
-          break;
         case '\r':
-          if (gtk_json_reader_remaining (reader) >= 2 && reader->data[1] == '\n')
-            reader->data++;
-          G_GNUC_FALLTHROUGH;
         case '\n':
           reader->data++;
-          reader->lines++;
-          reader->line_start = reader->data;
           break;
         default:
           return;
@@ -258,16 +246,6 @@ gtk_json_reader_parse_string (GtkJsonReader  *reader,
         case '\0':
           goto end;
 
-        case '\r':
-          if (reader->data + 1 < reader->end && reader->data[1] == '\n')
-            reader->data++;
-          G_GNUC_FALLTHROUGH;
-        case '\n':
-          reader->data++;
-          reader->lines++;
-          reader->line_start = reader->data;
-          break;
-
         case '"':
           if (!g_utf8_validate ((const char *) last, reader->data - last, (const char **) &reader->data))
             {


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