From bc8a7ae5f920560954b7f1486b585ac825fe698e Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 19 Feb 2018 18:12:13 -0500 Subject: [PATCH] qapi: Consistent generated code: prefer error 'err' We had some pointless differences in the generated code for visit, command marshalling, and events; unifying them makes it easier for future patches to consolidate to common helper functions. This is one patch of a series to clean up these differences. This patch consistently names the local error variable 'err' rather than 'local_err'. No change in semantics to the generated code. Backports commit 2a0f50e8d973b01eda4c63bac4a5c79ea0f584ef from qemu --- qemu/scripts/qapi-event.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qemu/scripts/qapi-event.py b/qemu/scripts/qapi-event.py index 3a6e9c51..d55d622f 100644 --- a/qemu/scripts/qapi-event.py +++ b/qemu/scripts/qapi-event.py @@ -47,7 +47,7 @@ def generate_event_implement(api_name, event_name, params): %(api_name)s { QDict *qmp; - Error *local_err = NULL; + Error *err = NULL; QMPEventFuncEmit emit; """, api_name = api_name) @@ -82,8 +82,8 @@ def generate_event_implement(api_name, event_name, params): g_assert(v); /* Fake visit, as if all members are under a structure */ - visit_start_struct(v, NULL, "", "%(event_name)s", 0, &local_err); - if (local_err) { + visit_start_struct(v, NULL, "", "%(event_name)s", 0, &err); + if (err) { goto clean; } @@ -104,8 +104,8 @@ def generate_event_implement(api_name, event_name, params): var_type = "" ret += mcgen(""" - visit_type_%(type)s(v, %(var_type)s&%(var)s, "%(name)s", &local_err); - if (local_err) { + visit_type_%(type)s(v, %(var_type)s&%(var)s, "%(name)s", &err); + if (err) { goto clean; } """, @@ -122,8 +122,8 @@ def generate_event_implement(api_name, event_name, params): ret += mcgen(""" - visit_end_struct(v, &local_err); - if (local_err) { + visit_end_struct(v, &err); + if (err) { goto clean; } @@ -135,7 +135,7 @@ def generate_event_implement(api_name, event_name, params): # step 4: call qmp event api ret += mcgen(""" - emit(%(event_enum_value)s, qmp, &local_err); + emit(%(event_enum_value)s, qmp, &err); """, event_enum_value = c_enum_const(event_enum_name, event_name)) @@ -147,7 +147,7 @@ def generate_event_implement(api_name, event_name, params): qmp_output_visitor_cleanup(qov); """) ret += mcgen(""" - error_propagate(errp, local_err); + error_propagate(errp, err); QDECREF(qmp); } """)