]> sigrok.org Git - libsigrokdecode.git/commitdiff
type_decoder: use ALL_ZERO for sentinels in method/member tables
authorGerhard Sittig <redacted>
Sat, 25 Dec 2021 18:52:30 +0000 (19:52 +0100)
committerGerhard Sittig <redacted>
Sun, 26 Dec 2021 12:45:09 +0000 (13:45 +0100)
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.

type_decoder.c

index d21e92d5d0df76501c0ceb7722e3089e3be7279d..38e0a036c4bdba081b6e4e8c95aec50f4063393f 100644 (file)
@@ -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;