nirs·4 năm trước·discussTypically you keep a list entry in the struct: https://man7.org/linux/man-pages/man3/stailq.3.html#EXAMPLESThe same list entry can be moved between several lists using the same type.If the struct need to be in multiple lists in the same time you can keep multiple list entries in the same struct: https://github.com/freebsd/freebsd-src/blob/69413598d2660054...
nirs·5 năm trước·discussTheses are good examples for not using ternary expressions. The code looks wrong even if it is correct, and it is hard to follow.There is a very simple rule avoiding most of these issues - if the ternary expression does not fit in one line, use if/else.
nirs·5 năm trước·discussp and q are the same file now, but after you change current directory their are not. They should never be equal.
The same list entry can be moved between several lists using the same type.
If the struct need to be in multiple lists in the same time you can keep multiple list entries in the same struct: https://github.com/freebsd/freebsd-src/blob/69413598d2660054...