Changeset 57 for trunk/zoo-kernel/service.h
- Timestamp:
- Jan 5, 2011, 3:20:01 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/service.h
r56 r57 133 133 map* tmp=m; 134 134 while(tmp!=NULL){ 135 if(str len(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0)135 if(strcasecmp(tmp->name,key)==0) 136 136 return true; 137 137 tmp=tmp->next; … … 146 146 maps* tmp=m; 147 147 while(tmp!=NULL){ 148 if(str len(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0){148 if(strcasecmp(tmp->name,key)==0){ 149 149 return tmp; 150 150 } … … 157 157 map* tmp=m; 158 158 while(tmp!=NULL){ 159 if(str len(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0){159 if(strcasecmp(tmp->name,key)==0){ 160 160 return tmp; 161 161 } … … 239 239 elements* tmp=e; 240 240 while(tmp!=NULL){ 241 if(str len(tmp->name)==strlen(key) && strncasecmp(key,tmp->name,strlen(key))==0)241 if(strcasecmp(key,tmp->name)==0) 242 242 return true; 243 243 tmp=tmp->next; … … 249 249 elements* tmp=m; 250 250 while(tmp!=NULL){ 251 if(str len(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(tmp->name))==0)251 if(strcasecmp(tmp->name,key)==0) 252 252 return tmp; 253 253 tmp=tmp->next; … … 260 260 iotype* _cursor=*i; 261 261 if(_cursor!=NULL){ 262 freeMap(&_cursor->content);263 free(_cursor->content);264 262 if(_cursor->next!=NULL){ 265 263 freeIOType(&_cursor->next); 266 264 free(_cursor->next); 267 265 } 266 freeMap(&_cursor->content); 267 free(_cursor->content); 268 268 } 269 269 } … … 272 272 elements* tmp=*e; 273 273 if(tmp!=NULL){ 274 free(tmp->name); 274 if(tmp->name!=NULL) 275 free(tmp->name); 275 276 freeMap(&tmp->content); 276 free(tmp->content); 277 if(tmp->content!=NULL) 278 free(tmp->content); 277 279 freeMap(&tmp->metadata); 278 free(tmp->metadata); 279 free(tmp->format); 280 if(tmp->metadata!=NULL) 281 free(tmp->metadata); 282 if(tmp->format!=NULL) 283 free(tmp->format); 280 284 freeIOType(&tmp->defaults); 281 285 if(tmp->defaults!=NULL) 282 286 free(tmp->defaults); 283 287 freeIOType(&tmp->supported); 284 if(tmp->supported!=NULL) 288 if(tmp->supported!=NULL){ 285 289 free(tmp->supported); 290 } 286 291 freeElements(&tmp->next); 287 292 } … … 361 366 static void addMapToIoType(iotype** io,map* mi){ 362 367 iotype* tmp=*io; 363 while(tmp!=NULL){ 364 #ifdef DEBUG 365 fprintf(stderr,">> CURRENT MAP"); 366 dumpMap(tmp->content); 367 #endif 368 tmp=tmp->next; 369 } 370 #ifdef DEBUG 371 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); 372 fflush(stderr); 373 #endif 374 tmp=(iotype*)malloc(IOTYPE_SIZE); 375 #ifdef DEBUG 376 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); 377 fflush(stderr); 378 #endif 379 tmp->content=NULL; 380 #ifdef DEBUG 381 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); 382 fflush(stderr); 383 #endif 384 addMapToMap(&tmp->content,mi); 385 #ifdef DEBUG 386 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); 387 fflush(stderr); 388 #endif 389 dumpMap(tmp->content); 390 tmp->next=NULL; 391 } 392 368 while(tmp->next!=NULL){ 369 tmp=tmp->next; 370 } 371 tmp->next=(iotype*)malloc(IOTYPE_SIZE); 372 tmp->next->content=NULL; 373 addMapToMap(&tmp->next->content,mi); 374 tmp->next->next=NULL; 375 } 376 377 static bool contains(map* m,map* i){ 378 while(i!=NULL){ 379 if(strcasecmp(i->name,"value")!=0 && 380 strcasecmp(i->name,"xlink:href")!=0){ 381 map *tmp; 382 if(hasKey(m,i->name) && (tmp=getMap(m,i->name))!=NULL && 383 strcasecmp(i->value,tmp->value)!=0) 384 return false; 385 } 386 i=i->next; 387 } 388 return true; 389 } 390 391 static iotype* getIoTypeFromElement(elements* e,char *name, map* values){ 392 elements* cursor=e; 393 while(cursor!=NULL){ 394 if(strcasecmp(cursor->name,name)==0){ 395 if(contains(cursor->defaults->content,values)==true) 396 return cursor->defaults; 397 else{ 398 iotype* tmp=cursor->supported; 399 while(tmp!=NULL){ 400 if(contains(tmp->content,values)==true) 401 return tmp; 402 tmp=tmp->next; 403 } 404 } 405 } 406 cursor=cursor->next; 407 } 408 return NULL; 409 } 393 410 394 411 static maps* dupMaps(maps** mo){ … … 434 451 free(_ztmpm->value); 435 452 _ztmpm->value=strdup(value); 436 dumpMap(_ztmpm);437 453 }else{ 438 454 addToMap(_tmpm->content,subkey,value); … … 502 518 tmp->supported=(iotype*)malloc(IOTYPE_SIZE); 503 519 tmp->supported->content=NULL; 520 addMapToMap(&tmp->supported->content,e->supported->content); 504 521 tmp->supported->next=NULL; 505 addMapToMap(&tmp->supported->content,e->supported->content);506 iotype *etmp=*(&tmp->supported->next) ;507 522 iotype *tmp2=e->supported->next; 508 523 while(tmp2!=NULL){ 509 etmp=(iotype*)malloc(IOTYPE_SIZE); 510 etmp->content=NULL; 511 addMapToMap(&etmp->content,tmp2->content); 512 etmp->next=NULL; 524 addMapToIoType(&tmp->supported,tmp2->content); 513 525 #ifdef DEBUG 514 526 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); … … 516 528 #endif 517 529 tmp2=tmp2->next; 518 etmp=etmp->next;519 530 } 520 531 } … … 532 543 *m=dupElements(tmp); 533 544 }else{ 534 while(_cursor->next!=NULL) 535 _cursor=_cursor->next; 536 _cursor->next=dupElements(tmp); 545 addToElements(&(*m)->next,tmp); 537 546 } 538 547 }
Note: See TracChangeset
for help on using the changeset viewer.