@@ -337,6 +337,9 @@ PyDoc_STRVAR(Reader_fileno__doc__,
337337static PyObject * Reader_fileno (Reader * self , PyObject * args ) {
338338 int fd ;
339339
340+ assert (self );
341+ assert (!args );
342+
340343 fd = sd_journal_get_fd (self -> j );
341344 set_error (fd , NULL , NULL );
342345 if (fd < 0 )
@@ -352,6 +355,9 @@ PyDoc_STRVAR(Reader_reliable_fd__doc__,
352355static PyObject * Reader_reliable_fd (Reader * self , PyObject * args ) {
353356 int r ;
354357
358+ assert (self );
359+ assert (!args );
360+
355361 r = sd_journal_reliable_fd (self -> j );
356362 if (set_error (r , NULL , NULL ) < 0 )
357363 return NULL ;
@@ -366,6 +372,9 @@ PyDoc_STRVAR(Reader_get_events__doc__,
366372static PyObject * Reader_get_events (Reader * self , PyObject * args ) {
367373 int r ;
368374
375+ assert (self );
376+ assert (!args );
377+
369378 r = sd_journal_get_events (self -> j );
370379 if (set_error (r , NULL , NULL ) < 0 )
371380 return NULL ;
@@ -384,6 +393,9 @@ static PyObject* Reader_get_timeout(Reader *self, PyObject *args) {
384393 int r ;
385394 uint64_t t ;
386395
396+ assert (self );
397+ assert (!args );
398+
387399 r = sd_journal_get_timeout (self -> j , & t );
388400 if (set_error (r , NULL , NULL ) < 0 )
389401 return NULL ;
@@ -404,6 +416,9 @@ static PyObject* Reader_get_timeout_ms(Reader *self, PyObject *args) {
404416 int r ;
405417 uint64_t t ;
406418
419+ assert (self );
420+ assert (!args );
421+
407422 r = sd_journal_get_timeout (self -> j , & t );
408423 if (set_error (r , NULL , NULL ) < 0 )
409424 return NULL ;
@@ -438,6 +453,9 @@ static PyObject* Reader_get_usage(Reader *self, PyObject *args) {
438453 int r ;
439454 uint64_t bytes ;
440455
456+ assert (self );
457+ assert (!args );
458+
441459 r = sd_journal_get_usage (self -> j , & bytes );
442460 if (set_error (r , NULL , NULL ) < 0 )
443461 return NULL ;
@@ -462,7 +480,9 @@ PyDoc_STRVAR(Reader___exit____doc__,
462480 "__exit__(type, value, traceback) -> None\n\n"
463481 "Part of the context manager protocol.\n"
464482 "Closes the journal.\n" );
465- static PyObject * Reader___exit__ (Reader * self , PyObject * args ) {
483+ static PyObject * Reader___exit__ (Reader * self , PyObject * args _unused_ ) {
484+ assert (self );
485+
466486 return Reader_close (self , NULL );
467487}
468488
@@ -475,6 +495,8 @@ static PyObject* Reader_next(Reader *self, PyObject *args) {
475495 int64_t skip = 1LL ;
476496 int r = - EUCLEAN ;
477497
498+ assert (self );
499+
478500 if (!PyArg_ParseTuple (args , "|L:next" , & skip ))
479501 return NULL ;
480502
@@ -590,6 +612,9 @@ static PyObject* Reader_get_all(Reader *self, PyObject *args) {
590612 size_t msg_len ;
591613 int r ;
592614
615+ assert (self );
616+ assert (!args );
617+
593618 dict = PyDict_New ();
594619 if (!dict )
595620 return NULL ;
@@ -706,6 +731,7 @@ static PyObject* Reader_add_match(Reader *self, PyObject *args, PyObject *keywds
706731 char * match ;
707732 Py_ssize_t match_len ;
708733 int r ;
734+
709735 if (!PyArg_ParseTuple (args , "s#:add_match" , & match , & match_len ))
710736 return NULL ;
711737
@@ -729,6 +755,10 @@ PyDoc_STRVAR(Reader_add_disjunction__doc__,
729755 "See :manpage:`sd_journal_add_disjunction(3)` for explanation." );
730756static PyObject * Reader_add_disjunction (Reader * self , PyObject * args ) {
731757 int r ;
758+
759+ assert (self );
760+ assert (!args );
761+
732762 r = sd_journal_add_disjunction (self -> j );
733763 if (set_error (r , NULL , NULL ) < 0 )
734764 return NULL ;
@@ -743,6 +773,10 @@ PyDoc_STRVAR(Reader_add_conjunction__doc__,
743773 "See :manpage:`sd_journal_add_disjunction(3)` for explanation." );
744774static PyObject * Reader_add_conjunction (Reader * self , PyObject * args ) {
745775 int r ;
776+
777+ assert (self );
778+ assert (!args );
779+
746780 r = sd_journal_add_conjunction (self -> j );
747781 if (set_error (r , NULL , NULL ) < 0 )
748782 return NULL ;
@@ -753,6 +787,9 @@ PyDoc_STRVAR(Reader_flush_matches__doc__,
753787 "flush_matches() -> None\n\n"
754788 "Clear all current match filters." );
755789static PyObject * Reader_flush_matches (Reader * self , PyObject * args ) {
790+ assert (self );
791+ assert (!args );
792+
756793 sd_journal_flush_matches (self -> j );
757794 Py_RETURN_NONE ;
758795}
@@ -764,6 +801,10 @@ PyDoc_STRVAR(Reader_seek_head__doc__,
764801 "See :manpage:`sd_journal_seek_head(3)`." );
765802static PyObject * Reader_seek_head (Reader * self , PyObject * args ) {
766803 int r ;
804+
805+ assert (self );
806+ assert (!args );
807+
767808 Py_BEGIN_ALLOW_THREADS
768809 r = sd_journal_seek_head (self -> j );
769810 Py_END_ALLOW_THREADS
@@ -782,6 +823,9 @@ PyDoc_STRVAR(Reader_seek_tail__doc__,
782823static PyObject * Reader_seek_tail (Reader * self , PyObject * args ) {
783824 int r ;
784825
826+ assert (self );
827+ assert (!args );
828+
785829 Py_BEGIN_ALLOW_THREADS
786830 r = sd_journal_seek_tail (self -> j );
787831 Py_END_ALLOW_THREADS
@@ -799,6 +843,8 @@ static PyObject* Reader_seek_realtime(Reader *self, PyObject *args) {
799843 uint64_t timestamp ;
800844 int r ;
801845
846+ assert (self );
847+
802848 if (!PyArg_ParseTuple (args , "K:seek_realtime" , & timestamp ))
803849 return NULL ;
804850
@@ -824,6 +870,8 @@ static PyObject* Reader_seek_monotonic(Reader *self, PyObject *args) {
824870 sd_id128_t id ;
825871 int r ;
826872
873+ assert (self );
874+
827875 if (!PyArg_ParseTuple (args , "K|z:seek_monotonic" , & timestamp , & bootid ))
828876 return NULL ;
829877
@@ -1061,6 +1109,9 @@ PyDoc_STRVAR(Reader_enumerate_fields__doc__,
10611109 "Return a set of field names appearing in the journal.\n"
10621110 "See sd_journal_enumerate_fields(3)." );
10631111static PyObject * Reader_enumerate_fields (Reader * self , PyObject * args ) {
1112+ assert (self );
1113+ assert (!args );
1114+
10641115#if HAVE_ENUMERATE_FIELDS
10651116 _cleanup_Py_DECREF_ PyObject * _value_set = NULL ;
10661117 PyObject * value_set ;
@@ -1103,6 +1154,9 @@ PyDoc_STRVAR(Reader_has_runtime_files__doc__,
11031154 "Returns true if runtime journal files have been found.\n\n"
11041155 "See :manpage:`sd_journal_test_cursor(3)`." );
11051156static PyObject * Reader_has_runtime_files (Reader * self , PyObject * args ) {
1157+ assert (self );
1158+ assert (!args );
1159+
11061160#if HAVE_ENUMERATE_FIELDS
11071161 int r ;
11081162
@@ -1124,6 +1178,9 @@ PyDoc_STRVAR(Reader_has_persistent_files__doc__,
11241178 "Returns true if persistent journal files have been found.\n\n"
11251179 "See :manpage:`sd_journal_test_cursor(3)`." );
11261180static PyObject * Reader_has_persistent_files (Reader * self , PyObject * args ) {
1181+ assert (self );
1182+ assert (!args );
1183+
11271184#if HAVE_ENUMERATE_FIELDS
11281185 int r ;
11291186
@@ -1185,7 +1242,7 @@ PyDoc_STRVAR(get_catalog__doc__,
11851242 "get_catalog(id128) -> str\n\n"
11861243 "Retrieve a message catalog entry for the given id.\n"
11871244 "Wraps :manpage:`sd_journal_get_catalog_for_message_id(3)`." );
1188- static PyObject * get_catalog (PyObject * self , PyObject * args ) {
1245+ static PyObject * get_catalog (PyObject * self _unused_ , PyObject * args ) {
11891246 int r ;
11901247 char * id_ = NULL ;
11911248 sd_id128_t id ;
@@ -1215,20 +1272,24 @@ PyDoc_STRVAR(data_threshold__doc__,
12151272 "Fields longer than this will be truncated to the threshold size.\n"
12161273 "Defaults to 64Kb." );
12171274
1218- static PyObject * Reader_get_data_threshold (Reader * self , void * closure ) {
1275+ static PyObject * Reader_get_data_threshold (Reader * self , void * closure _unused_ ) {
12191276 size_t cvalue ;
12201277 int r ;
12211278
1279+ assert (self );
1280+
12221281 r = sd_journal_get_data_threshold (self -> j , & cvalue );
12231282 if (set_error (r , NULL , NULL ) < 0 )
12241283 return NULL ;
12251284
12261285 return long_FromSize_t (cvalue );
12271286}
12281287
1229- static int Reader_set_data_threshold (Reader * self , PyObject * value , void * closure ) {
1288+ static int Reader_set_data_threshold (Reader * self , PyObject * value , void * closure _unused_ ) {
12301289 int r ;
12311290
1291+ assert (self );
1292+
12321293 if (!value ) {
12331294 PyErr_SetString (PyExc_AttributeError , "Cannot delete data threshold" );
12341295 return -1 ;
@@ -1245,7 +1306,9 @@ static int Reader_set_data_threshold(Reader *self, PyObject *value, void *closur
12451306
12461307PyDoc_STRVAR (closed__doc__ ,
12471308 "True iff journal is closed" );
1248- static PyObject * Reader_get_closed (Reader * self , void * closure ) {
1309+ static PyObject * Reader_get_closed (Reader * self , void * closure _unused_ ) {
1310+ assert (self );
1311+
12491312 return PyBool_FromLong (!self -> j );
12501313}
12511314
0 commit comments