Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing identation in context_new #384

Open
Kamilcuk opened this issue Mar 19, 2023 · 0 comments
Open

Confusing identation in context_new #384

Kamilcuk opened this issue Mar 19, 2023 · 0 comments

Comments

@Kamilcuk
Copy link

While analyzing context_new I found very confusing identation:

	n->component[3] = 0;
	for (i = 0, tok = str; *tok; i++) {
		if (i < 3)
			for (p = tok; *p && *p != ':'; p++) {	/* empty */
		} else {
			/* MLS range is one component */
			for (p = tok; *p; p++) {	/* empty */
			}
		}

The n->component[3] is set above and ven be removed. The for (p = tok; *p && *p != ':'; p++) { braces ends in } else which is confusing. Consider:

	for (i = 0, tok = str; *tok; i++) {
		if (i < 3) {
			for (p = tok; *p && *p != ':'; p++) {
                               /* empty */
                       }
		} else {
			/* MLS range is one component */
			for (p = tok; *p; p++) {
                               /* empty */
			}
		}

or

	for (i = 0, tok = str; *tok; i++) {
             /* MLS range is one component */
             for (p = tok; *p && (i < 3 || *p != ':'); p++) {
                    /* empty */
              }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant