| 143 | // |
| 144 | |
| 145 | void |
| 146 | CacheHostMatcher::NewEntry(matcher_line *line_info) |
| 147 | { |
| 148 | CacheHostRecord *cur_d; |
| 149 | int errNo; |
| 150 | char *match_data; |
| 151 | |
| 152 | // Make sure space has been allocated |
| 153 | ink_assert(num_el >= 0); |
| 154 | ink_assert(array_len >= 0); |
| 155 | |
| 156 | // Make sure we do not overrun the array; |
| 157 | ink_assert(num_el < array_len); |
| 158 | |
| 159 | match_data = line_info->line[1][line_info->dest_entry]; |
| 160 | |
| 161 | // Make sure that the line_info is not bogus |
| 162 | ink_assert(line_info->dest_entry < MATCHER_MAX_TOKENS); |
| 163 | ink_assert(match_data != nullptr); |
| 164 | |
| 165 | // Remove our consumed label from the parsed line |
| 166 | if (line_info->dest_entry < MATCHER_MAX_TOKENS) { |
| 167 | line_info->line[0][line_info->dest_entry] = nullptr; |
| 168 | } |
| 169 | line_info->num_el--; |
| 170 | |
| 171 | // Fill in the parameter info |
| 172 | cur_d = data_array + num_el; |
| 173 | errNo = cur_d->Init(line_info, type); |
| 174 | |
| 175 | if (errNo) { |
| 176 | // There was a problem so undo the effects this function |
| 177 | memset(static_cast<void *>(cur_d), 0, sizeof(CacheHostRecord)); |
| 178 | return; |
| 179 | } |
| 180 | Dbg(dbg_ctl_cache_hosting, "hostname: %s, host record: %p", match_data, cur_d); |
| 181 | // Fill in the matching info |
| 182 | host_lookup->NewEntry(match_data, (line_info->type == MATCH_DOMAIN) ? true : false, cur_d); |
| 183 | |
| 184 | num_el++; |
| 185 | return; |
| 186 | } |
| 187 | |
| 188 | /************************************************************* |
| 189 | * End class HostMatcher |
no test coverage detected