> On Oct. 30, 2017, 3:44 p.m., Benjamin Bannier wrote: > > src/common/resources_utils.cpp > > Lines 97 (patched) > > <https://reviews.apache.org/r/63414/diff/1/?file=1872669#file1872669line97> > > > > We should try to prevent the initialization and copy assignement of > > `resource`, e.g., > > > > > > Resource* resource = nullptr; > > > > switch (operation.type()) { > > // Possibly assign to `resource`. > > } > > > > CHECK_NOT_NULL(resource); > > > > if (resource->has_provider_id()) { > > return resource->provider_id(); > > } > > > > return None();
I used `Option<Resource>` here. Using pointer is tricky because the parameter we passed in is const. - Jie ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/63414/#review189597 ----------------------------------------------------------- On Oct. 30, 2017, 3:33 p.m., Jie Yu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/63414/ > ----------------------------------------------------------- > > (Updated Oct. 30, 2017, 3:33 p.m.) > > > Review request for mesos and Benjamin Bannier. > > > Bugs: MESOS-7235 > https://issues.apache.org/jira/browse/MESOS-7235 > > > Repository: mesos > > > Description > ------- > > Added a helper to get the resoruce provider ID from an offer operation. > > > Diffs > ----- > > src/common/resources_utils.hpp 18e3d9d4baad23669d00542594f5c15a989b7b9e > src/common/resources_utils.cpp e34cd8a3c9046a6f12c12a275a7b3a852b492f4c > > > Diff: https://reviews.apache.org/r/63414/diff/1/ > > > Testing > ------- > > make check > > > Thanks, > > Jie Yu > >