[PATCH v2 11/16] scripts/qapi: pull c_name from camel_to_upper to caller

Paolo Bonzini
2026-01-08T13:12:52Z

Allow using it for other languages too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/qapi/common.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 14d5dd259c4..c75396a01b5 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -61,7 +61,7 @@ def camel_to_upper(value: str) -> str:
ret += ch
upc = ch.isupper()

- return c_name(ret.upper()).lstrip('_')
+ return ret.upper()

def c_enum_const(type_name: str,
@@ -75,7 +75,7 @@ def c_enum_const(type_name: str,
:param prefix: Optional, prefix that overrides the type_name.
"""
if prefix is None:
- prefix = camel_to_upper(type_name)
+ prefix = c_name(camel_to_upper(type_name)).lstrip('_')
return prefix + '_' + c_name(const_name, False).upper()

--
2.52.0