Skip to content

Commit

Permalink
telev: make parameter const and add NULL pointer check
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 authored and sreimers committed Sep 23, 2022
1 parent d82cb2a commit 8ee6930
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/re_telev.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int telev_set_srate(struct telev *tel, uint32_t srate);
int telev_send(struct telev *tel, int event, bool end);
int telev_recv(struct telev *tel, struct mbuf *mb, int *event, bool *end);
int telev_poll(struct telev *tel, bool *marker, struct mbuf *mb);
bool telev_is_empty(struct telev *tel);
bool telev_is_empty(const struct telev *tel);

int telev_digit2code(int digit);
int telev_code2digit(int code);
5 changes: 4 additions & 1 deletion src/telev/telev.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,11 @@ int telev_poll(struct telev *tel, bool *marker, struct mbuf *mb)
}


bool telev_is_empty(struct telev *tel)
bool telev_is_empty(const struct telev *tel)
{
if (!tel)
return true;

return tel->state == IDLE && !mbuf_get_left(tel->mb);
}

Expand Down

0 comments on commit 8ee6930

Please sign in to comment.