Coding style change
This commit is contained in:
+8
-8
@@ -13,7 +13,7 @@ struct IOMux *iomux_create(enum IOMUX_TYPE type)
|
||||
int rc = -1;
|
||||
|
||||
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case IOMUX_TYPE_DEFAULT:
|
||||
case IOMUX_TYPE_EPOLL:
|
||||
rc = iomux_epoll_init(mux);
|
||||
@@ -23,12 +23,12 @@ struct IOMux *iomux_create(enum IOMUX_TYPE type)
|
||||
break;
|
||||
}
|
||||
|
||||
if(rc != 0) {
|
||||
if (rc != 0) {
|
||||
//try fallback to select
|
||||
rc = iomux_select_init(mux);
|
||||
}
|
||||
|
||||
if(rc == 0) {
|
||||
if (rc == 0) {
|
||||
rc = gettimeofday(&mux->now, NULL);
|
||||
assert(rc == 0);
|
||||
uc_timers_init(&mux->timers);
|
||||
@@ -50,7 +50,7 @@ void iomux_delete(struct IOMux *mux)
|
||||
//convert the difference between future and now
|
||||
static inline void future_to_interval(struct timeval *future, const struct timeval *now, struct timeval *result)
|
||||
{
|
||||
if(timercmp(future, now, >)) {
|
||||
if (timercmp(future, now, >)) {
|
||||
timersub(future, now, result);
|
||||
} else {
|
||||
result->tv_sec = 0;
|
||||
@@ -60,7 +60,7 @@ static inline void future_to_interval(struct timeval *future, const struct timev
|
||||
|
||||
int iomux_run(struct IOMux *mux)
|
||||
{
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
int rc;
|
||||
struct timeval first_timer;
|
||||
struct timeval timeout;
|
||||
@@ -71,7 +71,7 @@ int iomux_run(struct IOMux *mux)
|
||||
rc = gettimeofday(&mux->now, NULL);
|
||||
assert(rc == 0);
|
||||
|
||||
if(uc_timers_first(&mux->timers, &first_timer) == 0) {
|
||||
if (uc_timers_first(&mux->timers, &first_timer) == 0) {
|
||||
future_to_interval(&first_timer, &mux->now, &timeout);
|
||||
timeoutp = &timeout;
|
||||
/* fprintf(stdout, "now %d %d future %d %d interval %d %d\n", mux->now.tv_sec, mux->now.tv_usec,
|
||||
@@ -88,10 +88,10 @@ int iomux_run(struct IOMux *mux)
|
||||
timeoutp = NULL; //no timeout
|
||||
}
|
||||
rc = mux->run_impl(mux, timeoutp);
|
||||
if(rc < 0)
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if(rc == 0 && !has_timers) //no more events, ever
|
||||
if (rc == 0 && !has_timers) //no more events, ever
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user