You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Yunkai Zhang (JIRA)" <ji...@apache.org> on 2013/01/10 15:32:12 UTC
[jira] [Updated] (TS-977) RecCore usage cleanup
[ https://issues.apache.org/jira/browse/TS-977?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yunkai Zhang updated TS-977:
----------------------------
Attachment: 0002-RecCore-remove-unnecessary-IOCORE_-wrapper-on-RecCor.patch
0001-RecCore-refine-P_RecCore.i-and-rename-it-to-P_RecCor.patch
[PATCH 1/2] RecCore: refine P_RecCore.i and rename it to
P_RecCore.cc
The suffix of P_RecCore.i is weird for us:
1) cscope can't find the function definition in it by default.
2) using *.i suffix usually indicates that there are something bad in design. We can share the code gracefully if spliting the function/class carefully.
Let's refine the code so that we can rename it to P_RecCore.cc safely.
BTW, remove an useless file: ./iocore/utils/diags.i.
I have noticed that there are several test_*.i files which is not so important for us, just keep it as it is.
[PATCH 2/2] RecCore: remove unnecessary IOCORE_* wrapper on RecCore API
For TS-977. Call RecCore API directly is mush better and clear than IOCORE_* wrapper.
> RecCore usage cleanup
> ---------------------
>
> Key: TS-977
> URL: https://issues.apache.org/jira/browse/TS-977
> Project: Traffic Server
> Issue Type: Task
> Components: Cleanup
> Reporter: Zhao Yongming
> Assignee: Zhao Yongming
> Priority: Minor
> Fix For: 3.3.1
>
> Attachments: 0001-RecCore-refine-P_RecCore.i-and-rename-it-to-P_RecCor.patch, 0002-RecCore-remove-unnecessary-IOCORE_-wrapper-on-RecCor.patch
>
>
> in RecCore.*
> {code}
> int RecGetRecordInt(const char *name, RecInt * rec_int, bool lock = true);
> //-------------------------------------------------------------------------
> // RecGetRecordXXX
> //-------------------------------------------------------------------------
> int
> RecGetRecordInt(const char *name, RecInt *rec_int, bool lock)
> {
> int err;
> RecData data;
> if ((err = RecGetRecord_Xmalloc(name, RECD_INT, &data, lock)) == REC_ERR_OKAY)
> *rec_int = data.rec_int;
> return err;
> }
> {code}
> and there is something heavy used:
> {code}
> //-------------------------------------------------------------------------
> // Backwards Compatibility Items (REC_ prefix)
> //-------------------------------------------------------------------------
> #define REC_ReadConfigInt32(_var,_config_var_name) do { \
> RecInt tmp = 0; \
> RecGetRecordInt(_config_var_name, (RecInt*) &tmp); \
> _var = (int32_t)tmp; \
> } while (0)
> #define REC_ReadConfigInteger(_var,_config_var_name) do { \
> RecInt tmp = 0; \
> RecGetRecordInt(_config_var_name, &tmp); \
> _var = tmp; \
> } while (0)
> {code}
> and a real case, the REC_ReadConfigInteger is renamed to IOCORE_ReadConfigInteger:
> {code}
> RecInt cache_config_threads_per_disk = 12;
> #define IOCORE_ReadConfigInteger REC_ReadConfigInteger
> IOCORE_ReadConfigInteger(cache_config_threads_per_disk, "proxy.config.cache.threads_per_disk");
> {code}
> my question is, why it is so complex in all these renaming? why not just:
> {code}
> RecGetRecordInt("proxy.config.cache.threads_per_disk", &cache_config_threads_per_disk);
> {code}
> brief talk with Leif, we may need to cleanup the use of REC_*. make it a small task here
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira