| 3135 | #if ( INCLUDE_xTaskGetHandle == 1 ) |
| 3136 | |
| 3137 | static TCB_t * prvSearchForNameWithinSingleList( List_t * pxList, |
| 3138 | const char pcNameToQuery[] ) |
| 3139 | { |
| 3140 | TCB_t * pxNextTCB, * pxFirstTCB, * pxReturn = NULL; |
| 3141 | UBaseType_t x; |
| 3142 | char cNextChar; |
| 3143 | BaseType_t xBreakLoop; |
| 3144 | |
| 3145 | /* This function is called with the scheduler suspended. */ |
| 3146 | |
| 3147 | if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 ) |
| 3148 | { |
| 3149 | listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */ |
| 3150 | |
| 3151 | do |
| 3152 | { |
| 3153 | listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */ |
| 3154 | |
| 3155 | /* Check each character in the name looking for a match or |
| 3156 | * mismatch. */ |
| 3157 | xBreakLoop = pdFALSE; |
| 3158 | |
| 3159 | for( x = ( UBaseType_t ) 0; x < ( UBaseType_t ) configMAX_TASK_NAME_LEN; x++ ) |
| 3160 | { |
| 3161 | cNextChar = pxNextTCB->pcTaskName[ x ]; |
| 3162 | |
| 3163 | if( cNextChar != pcNameToQuery[ x ] ) |
| 3164 | { |
| 3165 | /* Characters didn't match. */ |
| 3166 | xBreakLoop = pdTRUE; |
| 3167 | } |
| 3168 | else if( cNextChar == ( char ) 0x00 ) |
| 3169 | { |
| 3170 | /* Both strings terminated, a match must have been |
| 3171 | * found. */ |
| 3172 | pxReturn = pxNextTCB; |
| 3173 | xBreakLoop = pdTRUE; |
| 3174 | } |
| 3175 | else |
| 3176 | { |
| 3177 | mtCOVERAGE_TEST_MARKER(); |
| 3178 | } |
| 3179 | |
| 3180 | if( xBreakLoop != pdFALSE ) |
| 3181 | { |
| 3182 | break; |
| 3183 | } |
| 3184 | } |
| 3185 | |
| 3186 | if( pxReturn != NULL ) |
| 3187 | { |
| 3188 | /* The handle has been found. */ |
| 3189 | break; |
| 3190 | } |
| 3191 | } while( pxNextTCB != pxFirstTCB ); |
| 3192 | } |
| 3193 | else |
| 3194 | { |