| 249 | } |
| 250 | |
| 251 | cdb_pair_t *cdb_dict_fetch(const cdb_key_t *key, const cdb_dict_t *dict) |
| 252 | { |
| 253 | struct list_head *_; |
| 254 | cdb_pair_t *pair; |
| 255 | |
| 256 | if (!dict) |
| 257 | return NULL; |
| 258 | |
| 259 | list_for_each (_, dict) { |
| 260 | pair = list_entry(_, cdb_pair_t, list); |
| 261 | |
| 262 | if ((key->is_pk && pair->key.is_pk) |
| 263 | || str_match(&pair->key.name, &key->name)) |
| 264 | return pair; |
| 265 | } |
| 266 | |
| 267 | return NULL; |
| 268 | } |
| 269 | |
| 270 | int dict_cmp(const cdb_dict_t *a, const cdb_dict_t *b) |
| 271 | { |