*** empty log message ***
This commit is contained in:
@ -1064,8 +1064,7 @@ pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr, SConnection *p
|
||||
pHdb parent = NULL;
|
||||
char *name;
|
||||
char *slash;
|
||||
CommandList *pCom;
|
||||
pDummy pDum;
|
||||
pObjectDescriptor pDes;
|
||||
int iret;
|
||||
|
||||
if (relpath[0] == '/' || rootpath == NULL) { /* absolute path */
|
||||
@ -1083,17 +1082,12 @@ pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr, SConnection *p
|
||||
slash = strchr(element+6, '/');
|
||||
if (slash != NULL) *slash = '\0'; /* split off object name */
|
||||
|
||||
pCom = FindCommand(pServ->pSics, element);
|
||||
if (pCom == NULL) {
|
||||
pDes = FindCommandDescriptor(pServ->pSics, element);
|
||||
if (pDes == NULL) {
|
||||
SCPrintf(pCon, eError, "ERROR: object %s not found", element);
|
||||
return NULL;
|
||||
}
|
||||
pDum = pCom->pData;
|
||||
if (pDum == NULL) {
|
||||
SCPrintf(pCon, eError, "ERROR: object %s has no data", element);
|
||||
return NULL;
|
||||
}
|
||||
node = pDum->pDescriptor->parNode;
|
||||
node = pDes->parNode;
|
||||
if (node == NULL) {
|
||||
SCPrintf(pCon, eError, "ERROR: object %s does not use hipadaba", element);
|
||||
return NULL;
|
||||
@ -1164,8 +1158,7 @@ int GetHdbPath(pHdb nodeArg, char *path, size_t pathlen) {
|
||||
pHdb node, parent;
|
||||
int len, pos, l;
|
||||
static char *sics="/sics";
|
||||
CommandList *pCom;
|
||||
pDummy pDum;
|
||||
pObjectDescriptor pDes;
|
||||
|
||||
path[0]='\0';
|
||||
if (nodeArg == NULL) {
|
||||
@ -1182,12 +1175,11 @@ int GetHdbPath(pHdb nodeArg, char *path, size_t pathlen) {
|
||||
|
||||
/* check root and add prefix */
|
||||
if (parent->mama != root) { /* not anchored in root */
|
||||
pCom = FindCommand(pServ->pSics, parent->name);
|
||||
if (!pCom) {
|
||||
pDes = FindCommandDescriptor(pServ->pSics, parent->name);
|
||||
if (!pDes) {
|
||||
return 0; /* not a sics object */
|
||||
}
|
||||
pDum = pCom->pData;
|
||||
if (pDum->pDescriptor->parNode != parent) {
|
||||
if (pDes->parNode != parent) {
|
||||
/* node named as a sics object, but command is not related to node */
|
||||
return 0;
|
||||
}
|
||||
@ -1595,7 +1587,7 @@ int readHdbValue(hdbValue *v, char *data, char *error, int errlen){
|
||||
double dValue;
|
||||
char number[80];
|
||||
char *pPtr = NULL;
|
||||
CommandList *pCom = NULL;
|
||||
void *objData;
|
||||
|
||||
switch(v->dataType){
|
||||
case HIPNONE:
|
||||
@ -1669,12 +1661,12 @@ int readHdbValue(hdbValue *v, char *data, char *error, int errlen){
|
||||
}
|
||||
break;
|
||||
case HIPOBJ:
|
||||
pCom = FindCommand(pServ->pSics,data);
|
||||
if(pCom == NULL && pCom->pData != NULL){
|
||||
objData = FindCommandData(pServ->pSics,data,NULL);
|
||||
if(objData == NULL){
|
||||
snprintf(error,errlen,"object %s NOT found", data);
|
||||
return 0;
|
||||
}
|
||||
v->v.obj = pCom->pData;
|
||||
v->v.obj = objData;
|
||||
break;
|
||||
case HIPFUNC:
|
||||
break;
|
||||
@ -2449,9 +2441,7 @@ static int LinkHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]){
|
||||
pHdb node = NULL;
|
||||
char buffer[256];
|
||||
CommandList *pCom = NULL;
|
||||
pDummy pDum = NULL;
|
||||
|
||||
pObjectDescriptor pDes = NULL;
|
||||
|
||||
if(argc < 3) {
|
||||
SCWrite(pCon,"ERROR: need path and object name to link",
|
||||
@ -2469,14 +2459,13 @@ static int LinkHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
|
||||
pCom = FindCommand(pSics,argv[2]);
|
||||
if(pCom == NULL){
|
||||
pDes = FindCommandDescriptor(pSics,argv[2]);
|
||||
if(pDes == NULL){
|
||||
snprintf(buffer,255,"ERROR: failed to find object %s", argv[2]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return 0;
|
||||
}
|
||||
pDum = pCom->pData;
|
||||
if(pDum == NULL || pDum->pDescriptor->parNode == NULL){
|
||||
if(pDes->parNode == NULL){
|
||||
snprintf(buffer,255,
|
||||
"ERROR: Object %s does not use Hipadaba natively and thus cannot be linked",
|
||||
argv[2]);
|
||||
@ -2484,7 +2473,7 @@ static int LinkHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(pDum->pDescriptor->parNode->mama != NULL){
|
||||
if(pDes->parNode->mama != NULL){
|
||||
snprintf(buffer,255,
|
||||
"ERROR: Object %s is already linked somewhere else",
|
||||
argv[2]);
|
||||
@ -2492,13 +2481,13 @@ static int LinkHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
|
||||
AddHipadabaChild(node,pDum->pDescriptor->parNode,pCon);
|
||||
AddHipadabaChild(node,pDes->parNode,pCon);
|
||||
|
||||
if(argc > 3){
|
||||
if(pDum->pDescriptor->parNode->name != NULL){
|
||||
free(pDum->pDescriptor->parNode->name);
|
||||
if(pDes->parNode->name != NULL){
|
||||
free(pDes->parNode->name);
|
||||
}
|
||||
pDum->pDescriptor->parNode->name = strdup(argv[3]);
|
||||
pDes->parNode->name = strdup(argv[3]);
|
||||
}
|
||||
|
||||
SCSendOK(pCon);
|
||||
|
Reference in New Issue
Block a user