SNMP: Replace mib_tree_entry struct with MEMPROXY class#2284
SNMP: Replace mib_tree_entry struct with MEMPROXY class#2284yadij wants to merge 2 commits intosquid-cache:masterfrom
Conversation
|
Steps 1 (use MEMPROXY for new/delete) and 2 (C++11 initialization and constructor) |
There was a problem hiding this comment.
Several other change requests also avoid in-class initialization of members that must be initialized via class constructor (assuming that they must be). In this and other PRs, let's give compiler a chance to warn us if we forget to initialize such members while refactoring object construction code.
Co-authored-by: Alex Rousskov <rousskov@measurement-factory.com>
| entry->len = len; | ||
| const auto entry = new mib_tree_entry(name, len, aggrType); | ||
| entry->parsefunction = parsefunction; | ||
| entry->instancefunction = instancefunction; |
There was a problem hiding this comment.
Is there any specific reasons for not including parsefunction and instancefunction in the constructor?
There was a problem hiding this comment.
Simplicity for now. Later refactor steps will change them.
There was a problem hiding this comment.
What does done look like with the later refactor steps?
There was a problem hiding this comment.
What does done look like with the later refactor steps?
I suspect there will be two mib_tree_entry constructors, one setting (constant) parse/instance functions and one prohibiting them. Or two C++ class types to differentiate the two use cases. Or perhaps a lot more classes, with those functions converted to class methods. Delaying that non-trivial refactoring may be the right decision, but I have not studied all the necessary details to be sure.
No description provided.