Skip to content

Commit

Permalink
make DefaultStorageKeyAllocator::Format protected so the class can be…
Browse files Browse the repository at this point in the history
… extended (#20326)

If integrating the matter PersistentStorageDelegate into an out-of-tree
implementation, it is useful to extend DefaultStorageKeyAllocator to
make it clear to maintainers that there is a single, shared key space
and that keys must avoid collision with those used in the sdk.

However, extending the PersistentStorageDelegate class is awkward
because the Format method is private.

Make it protected to streamline extending the class.
  • Loading branch information
msandstedt authored and pull[bot] committed Feb 2, 2024
1 parent f7ef008 commit 1478242
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/support/DefaultStorageKeyAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class DefaultStorageKeyAllocator
// Event number counter.
const char * IMEventNumber() { return Format("g/im/ec"); }

private:
protected:
// The ENFORCE_FORMAT args are "off by one" because this is a class method,
// with an implicit "this" as first arg.
const char * ENFORCE_FORMAT(2, 3) Format(const char * format, ...)
Expand All @@ -126,6 +126,7 @@ class DefaultStorageKeyAllocator
return mKeyName;
}

private:
char mKeyName[PersistentStorageDelegate::kKeyLengthMax + 1] = { 0 };
};

Expand Down

0 comments on commit 1478242

Please sign in to comment.