No need to handle impossible things.

The string given to logmanager_write_log cannot be NULL.
The id given to logmanager_write_log cannot be invalid.
Consequently we need not handle those possibilities.
This commit is contained in:
Johan Wikman
2015-11-10 18:12:25 +02:00
parent acb0a523a7
commit 42cf1c58d6

View File

@ -627,30 +627,14 @@ static int logmanager_write_log(logfile_id_t id,
size_t timestamp_len;
int i;
assert(str);
assert(logmanager_is_valid_id(id));
CHK_LOGMANAGER(lm);
if (!logmanager_is_valid_id(id))
{
err = -1;
ss_dassert(false);
goto return_err;
}
// All messages are now logged to the error log file.
lf = &lm->lm_logfile;
CHK_LOGFILE(lf);
/**
* When string pointer is NULL, operation is flush.
*/
if (str == NULL)
{
if (flush)
{
logfile_flush(lf); /*< wakes up file writer */
}
}
else
{
/** Length of string that will be written, limited by bufsize */
size_t safe_str_len;
/** Length of session id */
@ -812,9 +796,7 @@ static int logmanager_write_log(logfile_id_t id,
{
free(wp);
}
} /* if (str == NULL) */
return_err:
return err;
}