Github user jpeach commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/634#discussion_r63218243
--- Diff: proxy/InkAPI.cc ---
@@ -8175,471 +8177,163 @@ TSHttpTxnConfigStringGet(TSHttpTxn txnp,
TSOverridableConfigKey conf, const char
return TS_SUCCESS;
}
+struct TXN_CONFIG_PAIR {
+ TSOverridableConfigKey cnf;
+ TSRecordDataType typ;
+ TXN_CONFIG_PAIR(TSOverridableConfigKey cnf = TS_CONFIG_NULL,
TSRecordDataType typ = TS_RECORDDATATYPE_INT)
+ {
+ this->cnf = cnf;
+ this->typ = typ ? typ : TS_RECORDDATATYPE_INT;
+ };
+};
+
+std::unordered_map<std::string, TXN_CONFIG_PAIR>
+create_map()
+{
+ std::unordered_map<std::string, TXN_CONFIG_PAIR> m;
--- End diff --
It think this would be clearer and more readable if you defined a static
const array of entries.
```C
struct entry {
const char * name;
TSOverridableConfigKey key;
TSRecordDataType dtype;
} values[] = {
{ "proxy.config.body_factory.template_base",
TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE, TS_RECORDDATATYPE_STRING},
...
};
```
When you create the map, just loop over the array and insert pointer
without copying any values.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---