From: Gerhard Sittig Date: Sat, 25 Dec 2021 18:52:30 +0000 (+0100) Subject: type_decoder: use ALL_ZERO for sentinels in method/member tables X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7337906cd06569485cbb88ff837b1cfce29cfd48;p=libsigrokdecode.git type_decoder: use ALL_ZERO for sentinels in method/member tables Avoid the full listing of all-zero struct members in sentinel items of object methods and class properties tables. Use the ALL_ZERO phrase instead which better reflects what's intended, and reliably silences warnings should structs' lengths differ across Python versions. --- diff --git a/type_decoder.c b/type_decoder.c index d21e92d..38e0a03 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -1196,7 +1196,7 @@ static PyMethodDef Decoder_methods[] = { Decoder_has_channel, METH_VARARGS, Decoder_has_channel_doc, }, - {NULL, NULL, 0, NULL} + ALL_ZERO, }; /** @@ -1213,7 +1213,7 @@ SRD_PRIV PyObject *srd_Decoder_type_new(void) { Py_tp_doc, Decoder_doc }, { Py_tp_methods, Decoder_methods }, { Py_tp_new, (void *)&PyType_GenericNew }, - { 0, NULL } + ALL_ZERO, }; PyObject *py_obj; PyGILState_STATE gstate;