For loop cleanup. NFC.

pull/479/head
Ryan Pavlik 2019-08-20 11:22:10 -05:00 committed by whitequark
parent 231dff6cd9
commit 15838dc5a1
7 changed files with 12 additions and 12 deletions

View File

@ -175,8 +175,8 @@ void TextWindow::DescribeSelection() {
e->str.c_str(), &ScreenEditTtfText, e->h.request().v);
Printf(true, " select new font");
SS.fonts.LoadAll();
int i;
for(i = 0; i < SS.fonts.l.n; i++) {
// Not using range-for here because we use i inside the output.
for(int i = 0; i < SS.fonts.l.n; i++) {
TtfFont *tf = &(SS.fonts.l[i]);
if(e->font == tf->FontFileBaseName()) {
Printf(false, "%Bp %s",

View File

@ -20,13 +20,12 @@ std::string Entity::DescriptionString() const {
void Entity::GenerateEdges(SEdgeList *el) {
SBezierList *sbl = GetOrGenerateBezierCurves();
int i, j;
for(i = 0; i < sbl->l.n; i++) {
for(int i = 0; i < sbl->l.n; i++) {
SBezier *sb = &(sbl->l[i]);
List<Vector> lv = {};
sb->MakePwlInto(&lv);
for(j = 1; j < lv.n; j++) {
for(int j = 1; j < lv.n; j++) {
el->AddEdge(lv[j-1], lv[j], style.v, i);
}
lv.Clear();

View File

@ -759,8 +759,8 @@ void VectorFileWriter::OutputLinesAndMesh(SBezierLoopSetSet *sblss, SMesh *sm) {
void VectorFileWriter::BezierAsPwl(SBezier *sb) {
List<Vector> lv = {};
sb->MakePwlInto(&lv, SS.ExportChordTolMm());
int i;
for(i = 1; i < lv.n; i++) {
for(int i = 1; i < lv.n; i++) {
SBezier sb = SBezier::From(lv[i-1], lv[i]);
Bezier(&sb);
}

View File

@ -148,6 +148,7 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
// Start from the first dirty group, and solve until the active group,
// since all groups after the active group are hidden.
// Not using range-for because we're tracking the indices.
for(i = 0; i < SK.groupOrder.n; i++) {
Group *g = SK.GetGroup(SK.groupOrder[i]);
if((!g->clean) || !g->IsSolvedOkay()) {
@ -213,6 +214,7 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
SK.entity.Clear();
SK.entity.ReserveMore(oldEntityCount);
// Not using range-for because we're using the index inside the loop.
for(i = 0; i < SK.groupOrder.n; i++) {
Group *g = SK.GetGroup(SK.groupOrder[i]);

View File

@ -849,6 +849,7 @@ void GraphicsWindow::EnsureValidActives() {
// The active group must exist, and not be the references.
Group *g = SK.group.FindByIdNoOops(activeGroup);
if((!g) || (g->h == Group::HGROUP_REFERENCES)) {
// Not using range-for because this is used to find an index.
int i;
for(i = 0; i < SK.groupOrder.n; i++) {
if(SK.groupOrder[i] != Group::HGROUP_REFERENCES) {

View File

@ -96,8 +96,7 @@ void GraphicsWindow::FixConstraintsForPointBeingDeleted(hEntity hpt) {
// those two points were implicitly coincident with each other. By
// deleting hpt (and all constraints that mention it), we will delete
// that relationship. So put it back here now.
int i;
for(i = 1; i < ld.n; i++) {
for(int i = 1; i < ld.n; i++) {
Constraint::ConstrainCoincident(ld[i-1], ld[i]);
}
ld.Clear();

View File

@ -335,10 +335,9 @@ bool SEdgeList::ContainsEdge(const SEdge *set) const {
//-----------------------------------------------------------------------------
void SEdgeList::CullExtraneousEdges(bool both) {
l.ClearTags();
int i, j;
for(i = 0; i < l.n; i++) {
for(int i = 0; i < l.n; i++) {
SEdge *se = &(l[i]);
for(j = i+1; j < l.n; j++) {
for(int j = i + 1; j < l.n; j++) {
SEdge *set = &(l[j]);
if((set->a).Equals(se->a) && (set->b).Equals(se->b)) {
// Two parallel edges exist; so keep only the first one.