Skip to content

Commit

Permalink
Swap the order of the loops.
Browse files Browse the repository at this point in the history
  • Loading branch information
joa-quim committed Nov 19, 2024
1 parent 23db990 commit 5a41221
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/mapproject.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,14 +888,14 @@ static void add_J_scale_if_needed(struct GMT_CTRL *GMT, struct GMT_OPTION *optio
char txt_a[GMT_LEN128] = {""};
struct GMT_OPTION *optJ = NULL, *optF = NULL;
if (options == NULL) return; /* No arguments given to begin, done here */
for (optJ = options; optJ; optJ = optJ->next) { /* Loop over all options in the linked list */
if (optJ->option == 'J' && optJ->arg && !strchr(optJ->arg, '/')) {
for (optF = options; optF; optF = optF->next) { /* Now search for -F */
if (optF->option == 'F') {
for (optF = options; optF; optF = optF->next) { /* Loop over all options in the linked list */
if (optF->option == 'F') {
for (optJ = options; optJ; optJ = optJ->next) { /* Now search for -J */
if (optJ->option == 'J' && optJ->arg && !strchr(optJ->arg, '/')) {
strcpy(txt_a, optJ->arg); /* Save the -J argument because we need to free it first (was a strdup)*/
free(optJ->arg);
optJ->arg = strdup(strcat(txt_a, "/1:1")); /* Add /1:1 to the -J argument */
break;
return;
}
}
}
Expand Down

0 comments on commit 5a41221

Please sign in to comment.