]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
scripts: fix API parsing of *** pointers
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 20 Sep 2021 16:24:45 +0000 (17:24 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 21 Sep 2021 15:22:30 +0000 (16:22 +0100)
The currrent generated API contains *** pointer types with bogus
whitespace in the middle:

  <arg name='keys' type='char ** *' info='pointer to a variable to store authorized keys'/>

because the tokenizer only tries to merge 2 distinct '*' together.
This refactors the code to merge an arbitrary number, resulting
in

  <arg name='keys' type='char ***' info='pointer to a variable to store authorized keys'/>

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
scripts/apibuild.py

index b94c0f6c09dd208f9fb6e9024fe2f670187f1852..722fd33f0ed78e98d33bab2b2172dac1a9e03cf4 100755 (executable)
@@ -603,13 +603,12 @@ class CLexer:
                         i = i + 3
                         continue
 
-                    j = i + 1
-                    if j < nline and line[j] in "+-*><=/%&!|":
-                        self.tokens.append(('op', line[i:j + 1]))
-                        i = j + 1
-                    else:
-                        self.tokens.append(('op', line[i]))
-                        i = i + 1
+                    j = i
+                    while (j + 1) < nline and line[j+1] in "+-*><=/%&!|":
+                        j = j + 1
+
+                    self.tokens.append(('op', line[i:j+1]))
+                    i = j + 1
                     continue
                 s = i
                 while i < nline: