| 2091 | |
| 2092 | |
| 2093 | static bool find_type(thread_db* tdbb, |
| 2094 | WIN* window, |
| 2095 | PAG* ppage, |
| 2096 | USHORT lock, |
| 2097 | USHORT type, |
| 2098 | UCHAR** entry_p, |
| 2099 | const UCHAR** clump_end) |
| 2100 | { |
| 2101 | /*********************************************** |
| 2102 | * |
| 2103 | * f i n d _ t y p e |
| 2104 | * |
| 2105 | *********************************************** |
| 2106 | * |
| 2107 | * Functional description |
| 2108 | * Find the requested type in a page. |
| 2109 | * RETURNS |
| 2110 | * pointer to type, pointer to end of page, header. |
| 2111 | * true - Found it |
| 2112 | * false - Not present |
| 2113 | * |
| 2114 | **************************************/ |
| 2115 | SET_TDBB(tdbb); |
| 2116 | |
| 2117 | while (true) |
| 2118 | { |
| 2119 | header_page* header = (header_page*) (*ppage); |
| 2120 | UCHAR* p = header->hdr_data; |
| 2121 | const SLONG next_page = header->hdr_next_page; |
| 2122 | |
| 2123 | UCHAR* q = 0; |
| 2124 | for (; (*p != HDR_end); p += 2u + p[1]) |
| 2125 | { |
| 2126 | if (*p == type) |
| 2127 | q = p; |
| 2128 | } |
| 2129 | |
| 2130 | if (q) |
| 2131 | { |
| 2132 | *entry_p = q; |
| 2133 | *clump_end = p; |
| 2134 | return true; |
| 2135 | } |
| 2136 | |
| 2137 | // Follow chain of pages |
| 2138 | |
| 2139 | if (next_page) |
| 2140 | *ppage = CCH_HANDOFF(tdbb, window, next_page, lock, pag_header); |
| 2141 | else |
| 2142 | return false; |
| 2143 | } |
| 2144 | } |
| 2145 | |
| 2146 | |
| 2147 | // Class PageSpace starts here |
no test coverage detected