static chunk_t *chunk_search_str(chunk_t *cur, const char *str, size_t len, nav_t nav, loc_t dir, int level) { /* Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do /* loop over the chunk list */ { pc = search_function(pc, nav); /* in either direction while */ } while ((pc != NULL) && /* the end of the list was not reached yet */ (is_expected_string_and_level(pc, str, level, len) == false)); return(pc); /* the latest chunk is the searched one */ }
static chunk_t *chunk_search_str(chunk_t *cur, const char *str, size_t len, scope_e scope, direction_e dir, int level) { /* * Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do // loop over the chunk list { pc = search_function(pc, scope); // in either direction while } while ( pc != nullptr // the end of the list was not reached yet && (is_expected_string_and_level(pc, str, level, len) == false)); return(pc); // the latest chunk is the searched one }