Get rid of that hideous goto

I'm not overly keen on the continues either :-)
This commit is contained in:
Malcolm Robb 2013-04-10 11:43:55 +01:00
parent e59142b9dc
commit f1935b280c

View file

@ -1349,8 +1349,8 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
pPreamble = &m[j]; pPreamble = &m[j];
pPayload = &m[j+MODES_PREAMBLE_SAMPLES]; pPayload = &m[j+MODES_PREAMBLE_SAMPLES];
if (use_correction) goto good_preamble; /* We already checked it. */ if (!use_correction) // This is not a re-try with phase correction
{ // so try to find a new preamble
/* First check of relations between the first 10 samples /* First check of relations between the first 10 samples
* representing a valid preamble. We don't even investigate further * representing a valid preamble. We don't even investigate further
* if this simple test is not passed. */ * if this simple test is not passed. */
@ -1399,11 +1399,12 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
continue; continue;
} }
Modes.stat_valid_preamble++; Modes.stat_valid_preamble++;
}
good_preamble: else {
/* If the previous attempt with this message failed, retry using /* If the previous attempt with this message failed, retry using
* magnitude correction. */ * magnitude correction. */
if (use_correction) { // Make a copy of the Payload, and phase correct the copy
memcpy(aux, pPayload, sizeof(aux)); memcpy(aux, pPayload, sizeof(aux));
applyPhaseCorrection(aux); applyPhaseCorrection(aux);
Modes.stat_out_of_phase++; Modes.stat_out_of_phase++;