For loops and conditions, when a non-zero literal appears as the condition (such as while(1)), we can generate while :; ... instead of while [ 1 != 0 ]; ... to avoid unnecessary comparisons. Similarly, loops and conditions that never execute or execute only once (do { ... } while (0)) could be removed.
The resulting code may be slightly faster on some shells, but it may not be worth the effort and increased code size.
For loops and conditions, when a non-zero literal appears as the condition (such as
while(1)), we can generatewhile :; ...instead ofwhile [ 1 != 0 ]; ...to avoid unnecessary comparisons. Similarly, loops and conditions that never execute or execute only once (do { ... } while (0)) could be removed.The resulting code may be slightly faster on some shells, but it may not be worth the effort and increased code size.