hujun260 opened a new pull request, #18322: URL: https://github.com/apache/nuttx/pull/18322
This PR refactors the semaphore post operation to improve code quality and reduce complexity metrics for HIS compliance, particularly focusing on reducing Cyclomatic Complexity (CCM). This contribution addresses code quality concerns in the semaphore subsystem by refactoring nxsem_post_slow() to extract blocking state determination logic into a dedicated helper function. This change improves maintainability while reducing the cognitive complexity of the main function. Key improvements include: 1. **Extract get_blocking() Helper Function**: Creates a new private static inline function that encapsulates the logic for determining the blocking state of both mutex and counting semaphore operations. 2. **Reduce nxsem_post_slow() Complexity**: By delegating the initialization and blocking state determination to get_blocking(), the main function becomes more focused and easier to understand. ### TEST -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
