diff --git a/sched.c b/sched.c index effd6d81055d4e6efbb641930621e0f3a4feaa5c..56a16bde40f660b202cb0e8028ace15761a4ebc0 100644 --- a/sched.c +++ b/sched.c @@ -391,15 +391,14 @@ long ast_sched_when(struct sched_context *con,int id) DEBUG(ast_log(LOG_DEBUG, "ast_sched_when()\n")); ast_mutex_lock(&con->lock); - s=con->schedq; - while (s!=NULL) { - if (s->id==id) break; - s=s->next; + for (s = con->schedq; s; s = s->next) { + if (s->id == id) + break; } secs=-1; if (s!=NULL) { struct timeval now = ast_tvnow(); - secs=s->when.tv_sec-now.tv_sec; + secs = s->when.tv_sec - now.tv_sec; } ast_mutex_unlock(&con->lock); return secs;