Skip to content

Commit fb9316d

Browse files
committed
guards (unnecessary, but why not)
1 parent be0db92 commit fb9316d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

fio-stl.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17538,6 +17538,8 @@ FIO_IFUNC fio___timer_event_s *fio___timer_event_new(
1753817538

1753917539
FIO_IFUNC void fio___timer_event_free(fio_timer_queue_s *tq,
1754017540
fio___timer_event_s *t) {
17541+
if (!t)
17542+
return;
1754117543
if (tq && (t->repetitions < 0 || fio_atomic_sub_fetch(&t->repetitions, 1))) {
1754217544
FIO___LOCK_LOCK(tq->lock);
1754317545
fio___timer_insert(&tq->next, t);
@@ -17614,15 +17616,16 @@ SFUNC void fio_timer_schedule FIO_NOOP(fio_timer_queue_s *timer,
1761417616
* they repeat).
1761517617
*/
1761617618
SFUNC void fio_timer_destroy(fio_timer_queue_s *tq) {
17617-
fio___timer_event_s *next;
17619+
if (!tq)
17620+
return;
17621+
fio___timer_event_s *next = NULL;
1761817622
FIO___LOCK_LOCK(tq->lock);
1761917623
next = tq->next;
1762017624
tq->next = NULL;
1762117625
FIO___LOCK_UNLOCK(tq->lock);
1762217626
FIO___LOCK_DESTROY(tq->lock);
1762317627
while (next) {
1762417628
fio___timer_event_s *tmp = next;
17625-
1762617629
next = next->next;
1762717630
fio___timer_event_free(NULL, tmp);
1762817631
}

fio-stl/102 queue.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ FIO_IFUNC fio___timer_event_s *fio___timer_event_new(
663663

664664
FIO_IFUNC void fio___timer_event_free(fio_timer_queue_s *tq,
665665
fio___timer_event_s *t) {
666+
if (!t)
667+
return;
666668
if (tq && (t->repetitions < 0 || fio_atomic_sub_fetch(&t->repetitions, 1))) {
667669
FIO___LOCK_LOCK(tq->lock);
668670
fio___timer_insert(&tq->next, t);
@@ -739,15 +741,16 @@ SFUNC void fio_timer_schedule FIO_NOOP(fio_timer_queue_s *timer,
739741
* they repeat).
740742
*/
741743
SFUNC void fio_timer_destroy(fio_timer_queue_s *tq) {
742-
fio___timer_event_s *next;
744+
if (!tq)
745+
return;
746+
fio___timer_event_s *next = NULL;
743747
FIO___LOCK_LOCK(tq->lock);
744748
next = tq->next;
745749
tq->next = NULL;
746750
FIO___LOCK_UNLOCK(tq->lock);
747751
FIO___LOCK_DESTROY(tq->lock);
748752
while (next) {
749753
fio___timer_event_s *tmp = next;
750-
751754
next = next->next;
752755
fio___timer_event_free(NULL, tmp);
753756
}

0 commit comments

Comments
 (0)