it was pointed out this function in a forum i read handle_setmaster(struct weston_launch *wl, struct msghdr *msg, ssize_t len) i saw this if (data->fd == -1) { error(0, 0, "missing drm fd in socket request"); goto out; <---- } out: <--- this do { <--- this len = send(wl->sock[0], &ret, sizeof ret, 0); } while (len < 0 && errno == EINTR); it seems to me very ugly but i understand weston is just a reference implementation too but in case someone wanna use it later would be nice to improve this, if you guide me a bit[im more of a c++ guy and not familiar with weston code] i can improve it
handle_open(struct weston_launch *wl, struct msghdr *msg, ssize_t len) here is present too
(In reply to comment #1) > handle_open(struct weston_launch *wl, struct msghdr *msg, ssize_t len) > > here is present too What is the problem you see? Weston is the reference implementation, but that doesn't imply that lower standards or quality.
While usage of 'goto' constantly receives a lot of negative press, it's usage in C code for error handling is generally considered cleaner than alternatives. In my personal opinion, I find it easier to read as well - rather than multiple levels of scope/indentation based on every potential error, you get a normal flow of code, where the (rare) errors cause the flow to break. If they require the same cleanup code, we sure don't want any duplication either. It's use should still be limited to specific applicable scenarios, but it's not a 'use a single goto and you'll cause a nuclear war' level style of issue. Hell, using a break in a switch statement is essentially a goto itself(!)
Not enough information to resolve this issue.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.