| 609 | } |
| 610 | |
| 611 | void Encoder::writeKey(slice s) { |
| 612 | int encoded; |
| 613 | if (_sharedKeys && _sharedKeys->encodeAndAdd(s, encoded)) { |
| 614 | writeKey(encoded); |
| 615 | return; |
| 616 | } |
| 617 | addingKey(); |
| 618 | const void* writtenKey = _writeString(s); |
| 619 | if (!writtenKey && _copyingCollection) |
| 620 | writtenKey = s.buf; // Workaround for written strings not being kept in memory by the Writer if it's writing to a file |
| 621 | addedKey({writtenKey, s.size}); |
| 622 | } |
| 623 | |
| 624 | void Encoder::writeKey(int n) { |
| 625 | assert_precondition(_sharedKeys || n == Dict::kMagicParentKey || gDisableNecessarySharedKeysCheck); |
no test coverage detected