-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix probable boolean logic error #13200
Conversation
Good eye! And thanks for repairing the test! Interestingly enough, this change wouldn't affect the CSS minimizing logic whatsoever without a p = cssmin_back_peek(parser);
if (p == ',' || p == '>' || p == ':') {
c = 0;
} else {
c = ' ';
} In other words we could actually write: case STATE_FREE:
case STATE_SELECTOR: and it would be the equivalent of either before or after your change. I think what the author intended was actually to trim ALL whitespace when in the if (c == ' ' || c == '\t' || c == '\n' || c == '\r') {
c = 0;
break;
} Note the usage of my break. Preserving the space is necessary on the selector for example: While we're in here, it would be nice to change: Also Probably some room to fix the parser code further as mentioned at the top of the file:
|
Oh wait, a slight difference: if ((c == ' ' || c == '\t')) {
p = cssmin_peek(parser);
if (p == '{' || p == '\t' || p == ' ' || p == '>' || p == ',') {
c = 0;
} else {
p = cssmin_back_peek(parser);
if (p == ',' || p == '>' || p == ':') {
c = 0;
} else {
c = ' ';
}
} c would be set to 0 in STATE_FREE of your version before it runs into the above code in STATE_SELECTOR. I would sooner still see a |
@mmcco Could you please update change log? |
Thank you |
Small description of change: This if condition is always false, and it seems clear that the author meant to use || rather than &&.
Thanks for your time,
Michael McConville
University of Utah