鉴于MESA_prof_load只提供读取int的接口,很多同事在设置端口时不方便,现同时支持int和unsigned short两种端口数值。
This commit is contained in:
@@ -148,7 +148,7 @@ enum MAAT_INIT_OPT
|
||||
MAAT_OPT_INSTANCE_NAME, //VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1, no more than 11 bytes.DEFAULT: MAAT_$tableinfo_path$.
|
||||
MAAT_OPT_DECRYPT_KEY, //VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. No DEFAULT.
|
||||
MAAT_OPT_REDIS_IP, //VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. No DEFAULT.
|
||||
MAAT_OPT_REDIS_PORT, //VALUE is a unsigned short, host order, SIZE= sizeof(unsigned short). No DEFAULT.
|
||||
MAAT_OPT_REDIS_PORT, //VALUE is a unsigned short or a signed int, host order, SIZE= sizeof(unsigned short) or sizeof(int). No DEFAULT.
|
||||
MAAT_OPT_REDIS_INDEX, //VALUE is interger *, 0~15, SIZE=sizeof(int). DEFAULT: 0.
|
||||
MAAT_OPT_CMD_AUTO_NUMBERING, //VALUE is interger *, 1 or 0, SIZE=sizeof(int). DEFAULT: 1.
|
||||
MAAT_OPT_DEFERRED_LOAD //VALUE is NULL,SIZE is 0. Default: Deffered initialization OFF.
|
||||
|
||||
@@ -585,11 +585,18 @@ int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const vo
|
||||
memcpy(_feather->redis_ip,value,size);
|
||||
break;
|
||||
case MAAT_OPT_REDIS_PORT:
|
||||
if((size_t)size!=sizeof(unsigned short))
|
||||
if((size_t)size==sizeof(unsigned short))
|
||||
{
|
||||
_feather->redis_port=*((unsigned short*)value);
|
||||
}
|
||||
else if((size_t)size==sizeof(int))
|
||||
{
|
||||
_feather->redis_port=*((int*)value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
_feather->redis_port=*((unsigned short*)value);
|
||||
break;
|
||||
case MAAT_OPT_REDIS_INDEX:
|
||||
if((size_t)size!=sizeof(int))
|
||||
|
||||
Reference in New Issue
Block a user