tty: conditionally assign to ret value only used by MPASS statement

This commit is contained in:
mmacy 2018-05-19 04:02:29 +00:00
parent d02acb9927
commit 3b202e89e0
2 changed files with 6 additions and 2 deletions

View File

@ -328,13 +328,15 @@ ttyinq_write(struct ttyinq *ti, const void *buf, size_t nbytes, int quote)
int
ttyinq_write_nofrag(struct ttyinq *ti, const void *buf, size_t nbytes, int quote)
{
#ifdef INVARIANTS
size_t ret;
#endif
if (ttyinq_bytesleft(ti) < nbytes)
return (-1);
/* We should always be able to write it back. */
ret = ttyinq_write(ti, buf, nbytes, quote);
DBGSET(ret, ttyinq_write(ti, buf, nbytes, quote));
MPASS(ret == nbytes);
return (0);

View File

@ -324,13 +324,15 @@ ttyoutq_write(struct ttyoutq *to, const void *buf, size_t nbytes)
int
ttyoutq_write_nofrag(struct ttyoutq *to, const void *buf, size_t nbytes)
{
#ifdef INVARIANTS
size_t ret;
#endif
if (ttyoutq_bytesleft(to) < nbytes)
return (-1);
/* We should always be able to write it back. */
ret = ttyoutq_write(to, buf, nbytes);
DBGSET(ret, ttyoutq_write(to, buf, nbytes));
MPASS(ret == nbytes);
return (0);