Re: [Vala] [patch] G.Scanner



Ok, I've found the problem: when a [SimpleType] contains a string, it's
automatically promoted to a more complex type which needs to be
destroyed. IMHO it's a bug with Vala and needs to at least print a
warning.

In the remaining time, here's the correct patch, please apply:

--- /usr/share/vala/vapi/glib-2.0.vapi.orig     2009-12-04
16:15:26.000000000 +0100
+++ /usr/share/vala/vapi/glib-2.0.vapi  2009-12-04 16:16:25.000000000
+0100
@@ -2139,13 +2139,17 @@ namespace GLib {
                public uint next_line;
                public uint next_position;
                public ScannerMsgFunc msg_handler;
-               public Scanner (ScannerConfig? config_templ);
+               public Scanner (ScannerConfig? config_templ = null);
                public void input_file (int input_fd);
                public void sync_file_offset ();
                public void input_text (string text, uint text_len);
                public TokenType peek_next_token ();
                public TokenType get_next_token ();
                public bool eof ();
+               public int cur_line ();
+               public int cur_position ();
+               public TokenType cur_token ();
+               public TokenValue cur_value ();
                public uint set_scope (uint scope_id);
                public void scope_add_symbol (uint scope_id, string symbol, void*
value);
                public void scope_foreach_symbol (uint scope_id, HFunc func);
@@ -2231,7 +2235,7 @@ namespace GLib {
                [CCode (cname="v_symbol")]
                public void* symbol;
                [CCode (cname="v_identifier")]
-               public string identifier;
+               public unowned string identifier;
                [CCode (cname="v_binary")]
                public ulong binary;
                [CCode (cname="v_octal")]
@@ -2245,9 +2249,9 @@ namespace GLib {
                [CCode (cname="v_hex")]
                public ulong hex;
                [CCode (cname="v_string")]
-               public string string;
+               public unowned string string;
                [CCode (cname="v_comment")]
-               public string comment;
+               public unowned string comment;
                [CCode (cname="v_char")]
                public uchar char;
                [CCode (cname="v_error")]


Plus, I'm tempted to get rid of all direct non-method access (following
the GSEAL movement for 3.0), but later.

Thanks,
        Xav






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