New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove a bunch of unnecessary macros. #482
Conversation
The main goal here is to sidestep differences between uncrustify 0.72 and 0.78. However, I realized that a lot of these macros were either duplicating functionality we already had, or were just as long as "inlining" the code would be. Just get rid of these macros. In the one place that we can't do this, just mark the macro as not to be indented by uncrustify. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
// Attach subscriptions | ||
ws->subs.resize(0); | ||
if (subs) { | ||
ws->subs.reserve(subs->subscriber_count); | ||
for (size_t i = 0; i < subs->subscriber_count; i++) { | ||
auto x = static_cast<CddsSubscription *>(subs->subscribers[i]); | ||
ws->subs.push_back(x); | ||
dds_waitset_attach(ws->waitseth, x->rdcondh, nelems++); | ||
} | ||
} | ||
|
||
// Attach guard conditions | ||
ws->gcs.resize(0); | ||
if (gcs) { | ||
ws->gcs.reserve(gcs->guard_condition_count); | ||
for (size_t i = 0; i < gcs->guard_condition_count; i++) { | ||
auto x = static_cast<CddsGuardCondition *>(gcs->guard_conditions[i]); | ||
ws->gcs.push_back(x); | ||
dds_waitset_attach(ws->waitseth, x->gcondh, nelems++); | ||
} | ||
} | ||
|
||
// Attach service servers | ||
ws->srvs.resize(0); | ||
if (srvs) { | ||
ws->srvs.reserve(srvs->service_count); | ||
for (size_t i = 0; i < srvs->service_count; i++) { | ||
auto x = static_cast<CddsService *>(srvs->services[i]); | ||
ws->srvs.push_back(x); | ||
dds_waitset_attach(ws->waitseth, x->service.sub->rdcondh, nelems++); | ||
} | ||
} | ||
|
||
// Attach service clients | ||
ws->cls.resize(0); | ||
if (cls) { | ||
ws->cls.reserve(cls->client_count); | ||
for (size_t i = 0; i < cls->client_count; i++) { | ||
auto x = static_cast<CddsClient *>(cls->clients[i]); | ||
ws->cls.push_back(x); | ||
dds_waitset_attach(ws->waitseth, x->client.sub->rdcondh, nelems++); | ||
} | ||
} | ||
|
||
// Attach events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers: this piece of code (and the DETACH below) are the places most likely to have some kind of problem during expansion. So please do a careful review of this section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The main goal here is to sidestep differences between uncrustify 0.72 and 0.78. However, I realized that a lot of these macros were either duplicating functionality we already had, or were just as long as "inlining" the code would be. Just get rid of these macros.
In the one place that we can't do this, just mark the macro as not to be indented by uncrustify.