Re: Any idea how to fix this C++ code in diann
Andreas Tille <andreas@an3as.eu> writes:
> I gave the packaging of diann a try but failed[1]. Any idea how
> to fix these goto statements?
Please try adding braces to indicate that the variables in question are
not of interest to these statements' targets, per the attached patch.
--
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
http://www.mit.edu/~amu/ | http://stuff.mit.edu/cgi/finger/?amu@monk.mit.edu
Index: b/src/diann.cpp
===================================================================
--- a/src/diann.cpp
+++ b/src/diann.cpp
@@ -2551,6 +2551,7 @@ struct Feature {
if (pos == frm.end()) continue;
while (pos->mz < high) {
if (open && iter == 1 && pos->charge != 1) goto finish;
+ {
auto &pr = precursors[pos->pr];
if ((open || (pr.first > min && pr.first < max)) && pr.second == charge) {
if (size <= pos->pr) size = ((pos->pr * 5) / 4) + 1, temp.resize(size);
@@ -2581,6 +2582,7 @@ struct Feature {
if (open) match[j].fr = fr;
}
}
+ }
finish:
pos++;
if (pos == frm.end()) break;
@@ -5397,6 +5399,7 @@ public:
goto save;
}
+ {
int ni = indices.size();
B.resize(ni); A.resize(ni, ni);
for (i = 0; i < ni; i++) {
@@ -5441,6 +5444,8 @@ public:
A.resize(0, 0);
}
+ }
+
save:
for (i = 0; i < prs_n; i++) {
int pr = pg.precursors[i];
Reply to: