| 167 | } |
| 168 | |
| 169 | void insert(const char *s) |
| 170 | { |
| 171 | auto len= strlen(s); |
| 172 | auto ls= (LEX_STRING *) my_malloc(key_memory_dbnames_cache, |
| 173 | sizeof(LEX_STRING) + strlen(s) + 1, 0); |
| 174 | |
| 175 | if (!ls) |
| 176 | return; |
| 177 | |
| 178 | ls->length= len; |
| 179 | ls->str= (char *) (ls + 1); |
| 180 | |
| 181 | memcpy(ls->str, s, len + 1); |
| 182 | mysql_rwlock_wrlock(&m_lock); |
| 183 | bool found= m_set.find(s, len) != 0; |
| 184 | if (!found) |
| 185 | m_set.insert(ls); |
| 186 | mysql_rwlock_unlock(&m_lock); |
| 187 | if (found) |
| 188 | my_free(ls); |
| 189 | } |
| 190 | |
| 191 | void clear() |
| 192 | { |
no test coverage detected