-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config: Add ConfObject::get() that accepts string literals
Almost all ConfObject::get() calls pass string literals, which are de-duplicated when placed in the rodata section with the string literals that were used to construct the ConfObject. Pass these strings through to the getter and use them for a fast address comparison instead of doing a slower string comparison on every key in the ConfObject. Unfortunately, the overloaded get(const char *) causes a conflict with ConfArray::get(size_t) because any use like get(1) will look for an int variant of get(), which will also match the const char * variant. Add several get() overloads for various integer types to weed out the undesirable ones. The int variant is also undesirable, but unfortunately required for get(1) to work. All get-wrappers can be inlined and optimized away. Also change the ConfirmKey convenience function to const char *, so that the optimized string address comparison works with it as well.
- Loading branch information
Showing
3 changed files
with
71 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters