[PATCH] qmi-codegen: allow empty input fields
Aleksander Morgado
aleksander at aleksander.es
Thu Feb 22 20:16:53 UTC 2018
The LOC service allows empty messages to trigger the sending of
certain indicator messages.
E.g. we can have a request creation method where we just ignore the
input bundle:
static QmiMessage *
__qmi_message_loc_get_operation_mode_request_create (
guint16 transaction_id,
guint8 cid,
QmiMessageLocGetOperationModeInput *input,
GError **error)
{
QmiMessage *self;
self = qmi_message_new (QMI_SERVICE_LOC,
cid,
transaction_id,
QMI_MESSAGE_LOC_GET_OPERATION_MODE);
return self;
}
Based on a patch from: Thomas Weißschuh <thomas at t-8ch.de>
---
Hey Thomas,
Wouldn't this change I suggested be enough for your use case? I still believe that not emitting the code that generates the label would be a cleaner option that starting to add G_GNUC_UNUSED to ignore the unused ones...
---
build-aux/qmi-codegen/Message.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build-aux/qmi-codegen/Message.py b/build-aux/qmi-codegen/Message.py
index 0bf62f1..ea6622b 100644
--- a/build-aux/qmi-codegen/Message.py
+++ b/build-aux/qmi-codegen/Message.py
@@ -121,7 +121,7 @@ class Message:
' ${message_id});\n' % input_arg_template)
cfile.write(string.Template(template).substitute(translations))
- if self.input.fields is not None:
+ if self.input.fields:
# Count how many mandatory fields we have
n_mandatory = 0
for field in self.input.fields:
@@ -179,7 +179,7 @@ class Message:
cfile.write(
'\n'
' return self;\n')
- if self.input.fields is not None:
+ if self.input.fields:
cfile.write(
'\n'
'error_out:\n'
--
2.15.1
More information about the libqmi-devel
mailing list