chore: code optimization
This commit is contained in:
parent
c0148ed5e1
commit
696d294f02
|
@ -523,7 +523,12 @@ static int32_t hbGetUserBasicInfo(SClientHbKey *connKey, SClientHbReq *req) {
|
||||||
return TSDB_CODE_APP_ERROR;
|
return TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
if (!pTscObj->passInfo.fp) {
|
||||||
|
goto _return;
|
||||||
|
}
|
||||||
|
|
||||||
SUserPassVersion *user = taosMemoryMalloc(sizeof(SUserPassVersion));
|
SUserPassVersion *user = taosMemoryMalloc(sizeof(SUserPassVersion));
|
||||||
if (!user) {
|
if (!user) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
|
@ -121,13 +121,15 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
|
||||||
|
|
||||||
int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param, int type) {
|
int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param, int type) {
|
||||||
if (taos == NULL) {
|
if (taos == NULL) {
|
||||||
return TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
STscObj *pObj = acquireTscObj(*(int64_t *)taos);
|
STscObj *pObj = acquireTscObj(*(int64_t *)taos);
|
||||||
if (NULL == pObj) {
|
if (NULL == pObj) {
|
||||||
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
tscError("invalid parameter for %s", __func__);
|
tscError("invalid parameter for %s", __func__);
|
||||||
return TSDB_CODE_TSC_DISCONNECTED;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -136,8 +138,11 @@ int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param, int type
|
||||||
pObj->passInfo.param = param;
|
pObj->passInfo.param = param;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
break;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
releaseTscObj(*(int64_t *)taos);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
releaseTscObj(*(int64_t *)taos);
|
releaseTscObj(*(int64_t *)taos);
|
||||||
|
|
|
@ -1455,6 +1455,7 @@ int32_t mndValidateUserPassInfo(SMnode *pMnode, SUserPassVersion *pUsers, int32_
|
||||||
|
|
||||||
if (!batchRsp.pArray && !(batchRsp.pArray = taosArrayInit(numOfUses, sizeof(SGetUserPassRsp)))) {
|
if (!batchRsp.pArray && !(batchRsp.pArray = taosArrayInit(numOfUses, sizeof(SGetUserPassRsp)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
mndReleaseUser(pMnode, pUser);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue