| 2666 | } |
| 2667 | |
| 2668 | static int store_aux(const char *key, const char *value, |
| 2669 | const struct config_context *ctx UNUSED, void *cb) |
| 2670 | { |
| 2671 | struct config_store_data *store = cb; |
| 2672 | |
| 2673 | if (store->key_seen) { |
| 2674 | if (matches(key, value, store)) { |
| 2675 | if (store->seen_nr == 1 && store->multi_replace == 0) { |
| 2676 | warning(_("%s has multiple values"), key); |
| 2677 | } |
| 2678 | |
| 2679 | ALLOC_GROW(store->seen, store->seen_nr + 1, |
| 2680 | store->seen_alloc); |
| 2681 | |
| 2682 | store->seen[store->seen_nr] = store->parsed_nr; |
| 2683 | store->seen_nr++; |
| 2684 | } |
| 2685 | } else if (store->is_keys_section) { |
| 2686 | /* |
| 2687 | * Do not increment matches yet: this may not be a match, but we |
| 2688 | * are in the desired section. |
| 2689 | */ |
| 2690 | ALLOC_GROW(store->seen, store->seen_nr + 1, store->seen_alloc); |
| 2691 | store->seen[store->seen_nr] = store->parsed_nr; |
| 2692 | store->section_seen = 1; |
| 2693 | |
| 2694 | if (matches(key, value, store)) { |
| 2695 | store->seen_nr++; |
| 2696 | store->key_seen = 1; |
| 2697 | } |
| 2698 | } |
| 2699 | |
| 2700 | return 0; |
| 2701 | } |
| 2702 | |
| 2703 | static int write_error(const char *filename) |
| 2704 | { |