Patchwork [v2,02/17] qapi: generate C types for fixed-width integers

login
register
mail settings
Submitter Laszlo Ersek
Date June 13, 2012, 8:22 a.m.
Message ID <1339575768-2557-3-git-send-email-lersek@redhat.com>
Download mbox | patch
Permalink /patch/164578/
State New
Headers show

Comments

Laszlo Ersek - June 13, 2012, 8:22 a.m.
(Long line folded using parens:
<http://www.python.org/dev/peps/pep-0008/#maximum-line-length>.)

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 scripts/qapi.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Paolo Bonzini - June 13, 2012, 10:48 a.m.
Il 13/06/2012 10:22, Laszlo Ersek ha scritto:
> (Long line folded using parens:
> <http://www.python.org/dev/peps/pep-0008/#maximum-line-length>.)
> 
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  scripts/qapi.py |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index e062336..1292476 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -159,6 +159,10 @@ def c_type(name):
>          return 'char *'
>      elif name == 'int':
>          return 'int64_t'
> +    elif (name == 'int8' or name == 'int16' or name == 'int32' or
> +          name == 'int64' or name == 'uint8' or name == 'uint16' or
> +          name == 'uint32' or name == 'uint64'):
> +        return name + '_t'
>      elif name == 'bool':
>          return 'bool'
>      elif name == 'number':
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Patch

diff --git a/scripts/qapi.py b/scripts/qapi.py
index e062336..1292476 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -159,6 +159,10 @@  def c_type(name):
         return 'char *'
     elif name == 'int':
         return 'int64_t'
+    elif (name == 'int8' or name == 'int16' or name == 'int32' or
+          name == 'int64' or name == 'uint8' or name == 'uint16' or
+          name == 'uint32' or name == 'uint64'):
+        return name + '_t'
     elif name == 'bool':
         return 'bool'
     elif name == 'number':