Skip to content

Commit

Permalink
Merge pull request #50 from CameronNemo/master
Browse files Browse the repository at this point in the history
kevent: refactor to remove goto statement
  • Loading branch information
mheily authored Oct 21, 2018
2 parents 7c9a8f2 + 2079efb commit 3f65586
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 0 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* Add a dbg_printf() statement within kevent_wait() to report the value
of the timeout.

* Refactor kevent_copyin() to remove the goto statements.

* Fix the crasher w/ corruption in test/vnode.c

* Add the kevent64() syscall as implemented on MacOS X. This guarantees
Expand Down
12 changes: 3 additions & 9 deletions src/common/kevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,23 +198,17 @@ kevent_copyin(struct kqueue *kq, const struct kevent *src, int nchanges,

dbg_printf("nchanges=%d nevents=%d", nchanges, nevents);

/* TODO: refactor, this has become convoluted to support EV_RECEIPT */
for (nret = 0; nchanges > 0; src++, nchanges--) {

if (kevent_copyin_one(kq, src) < 0) {
dbg_printf("errno=%s",strerror(errno));
status = errno;
goto err_path;
} else if (src->flags & EV_RECEIPT) {
status = 0;
} else {
if (src->flags & EV_RECEIPT) {
status = 0;
goto err_path;
}
continue;
}

continue;

err_path:
if (nevents > 0) {
memcpy(eventlist, src, sizeof(*src));
eventlist->data = status;
Expand Down

0 comments on commit 3f65586

Please sign in to comment.