Skip to content

Commit

Permalink
Merge pull request LinuxCNC#3319 from BsAtHome/fix_postfix-iterator
Browse files Browse the repository at this point in the history
Use prefix ++ on iterators
  • Loading branch information
andypugh authored Feb 6, 2025
2 parents 18c03fd + f0ea9cd commit 21fe47f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions src/emc/rs274ngc/interp_g7x.cc
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ class g7x:public std::list<std::unique_ptr<segment>> {
auto p(h); --p;
(*h)->do_finish((*p).get(),(*(++h)).get());
}
for(auto p=begin(); p!=end(); p++)
for(auto p=begin(); p!=end(); ++p)
if((*p)->radius()<1e-3)
erase(p--);
}
Expand Down Expand Up @@ -741,7 +741,7 @@ void g7x::pocket(int cycle, std::complex<double> location, iterator p,

if(cycle==2) {
// This skips the initial roughing pass
for(; p!=end(); p++) {
for(; p!=end(); ++p) {
if((*p)->dive(location,-1e9,out,p==begin()))
break;
}
Expand All @@ -756,13 +756,13 @@ void g7x::pocket(int cycle, std::complex<double> location, iterator p,
/* After the initial roughing pass, move along the final
contour and we're done
*/
for(; p!=end(); p++)
for(; p!=end(); ++p)
(*p)->climb_only(location,out);
} else {
/* Move along the final contour until a pocket is found,
then start cutting that pocket
*/
for(; p!=end(); p++) {
for(; p!=end(); ++p) {
if((*p)->climb(location,out)) {
if(cycle==3) {
if(imag(location)>imag(pocket_starts.back())
Expand Down Expand Up @@ -791,11 +791,11 @@ void g7x::pocket(int cycle, std::complex<double> location, iterator p,
/* Our x coordinate is beyond the current segment, move onto
the next
*/
p++;
++p;
continue;
}

for(auto ip=p; ip!=end(); ip++) {
for(auto ip=p; ip!=end(); ++ip) {
segment::intersections_t is;
(*ip)->intersection_z(location.imag(),is);
if(is.empty())
Expand Down Expand Up @@ -857,13 +857,13 @@ void g7x::add_distance(double distance) {
if(distance<0)
max_distance=-max_distance;

for(auto p=begin(); p!=end(); p++) {
for(auto p=begin(); p!=end(); ++p) {
(*p)->offset(max_distance);
if((*p)->radius()<1e-3)
erase(p--);
}

for(auto p=begin(); p!=--end(); p++) {
for(auto p=begin(); p!=--end(); ++p) {
auto n=p; ++n;
if(real((*p)->ep()-(*n)->sp())>1e-2) {
// insert connecting arc
Expand All @@ -874,11 +874,11 @@ void g7x::add_distance(double distance) {
auto center=(s->ep()+e->sp())/2.0;
emplace(n, std::make_unique<round_segment>(
distance>0,(*p)->ep(),center,(*n)->sp()));
p++;
++p;
}
}

for(auto p=begin(); p!=--end(); p++) {
for(auto p=begin(); p!=--end(); ++p) {
if(!(*p)->monotonic()) {
std::cout << "Oops " << (*p)->sp()-(*p)->ep() << std::endl;
auto pp=p; --pp;
Expand All @@ -897,7 +897,7 @@ void g7x::add_distance(double distance) {
}
current_distance+=max_distance;
}
for(auto p=begin(); p!=--end(); p++) {
for(auto p=begin(); p!=--end(); ++p) {
auto n=p; ++n;
auto mid=((*p)->ep()+(*n)->sp())/2.0;
(*p)->ep()=(*n)->sp()=mid;
Expand Down
2 changes: 1 addition & 1 deletion src/emc/task/emccanon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ linkable(double x, double y, double z,
if(x==canon.endPoint.x && y==canon.endPoint.y && z==canon.endPoint.z) return false;

for(std::vector<struct pt>::iterator it = chained_points.begin();
it != chained_points.end(); it++) {
it != chained_points.end(); ++it) {
PM_CARTESIAN M(x-canon.endPoint.x, y-canon.endPoint.y, z-canon.endPoint.z),
B(canon.endPoint.x, canon.endPoint.y, canon.endPoint.z),
P(it->x, it->y, it->z);
Expand Down
2 changes: 1 addition & 1 deletion src/hal/halmodule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static PyObject *pyhal_get_pins(PyObject *_self, PyObject * /*o*/) {
EXCEPTION_IF_NOT_LIVE(NULL);

PyObject *d = PyDict_New();
for(itemmap::iterator i = self->items->begin(); i != self->items->end(); i++) {
for(itemmap::iterator i = self->items->begin(); i != self->items->end(); ++i) {
halitem * pin = &(i->second);
name = strdup(i->first.c_str());
PyDict_SetItemString(d, name, pyhal_read_common(pin));
Expand Down

0 comments on commit 21fe47f

Please sign in to comment.