]> xenbits.xensource.com Git - libvirt.git/commitdiff
apibuild: Substitute only pure number tokens
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 30 May 2016 13:38:07 +0000 (15:38 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 30 May 2016 13:38:07 +0000 (15:38 +0200)
In 38df47c9af1 I've tried to prepare our apibuild.py script for
change made in 0628f3498ce (1U << 31). What I've done in the
former commit was to replace \d+U in parsed tokens with \d.
Problem was, my regular expression there was not quite right as
it also translated VIR_123U_VAL into VIR_123_VAL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
docs/apibuild.py

index 712b8b9b237666fc4d8f78534e70567a5dcbaea0..f5216ea930e5e268e48917f834d989d6bbfeb302 100755 (executable)
@@ -1399,7 +1399,7 @@ class CParser:
                     while token[0] != "sep" or (token[1] != ',' and
                           token[1] != '}'):
                         # We might be dealing with '1U << 12' here
-                        value = value + re.sub("(\d+)U","\\1", token[1])
+                        value = value + re.sub("^(\d+)U$","\\1", token[1])
                         token = self.token()
                 else:
                     try: