Changeset 1447 for trunk/psLib/src/collections/psMetadata.c
- Timestamp:
- Aug 9, 2004, 3:43:05 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psMetadata.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psMetadata.c
r1440 r1447 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08- 09 23:34:57$14 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-10 01:43:05 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 501 501 psMetadataItem* entry = NULL; 502 502 503 504 if (md == NULL) { 505 psError(__func__, "Null metadata collection not allowed"); 506 return NULL; 507 } 508 503 509 mdList = md->list; 504 510 if (mdList == NULL) { … … 507 513 } 508 514 515 psListSetIterator(mdList, which); 516 entry = psListGetCurrent(mdList); 517 while (entry != NULL) { 518 if(match != NULL) { 519 if (!strncmp(match, entry->name, strlen(match))) { 520 521 // Match found 522 return entry; 523 } 524 entry = psListGetNext(mdList); 525 } else { 526 return psListGetNext(mdList); 527 } 528 } 529 530 // Match not found 531 if (entry == NULL) { 532 psError(__func__, "Couldn't find metadata item"); 533 } 534 535 return entry; 536 } 537 538 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which) 539 { 540 psList* mdList = NULL; 541 psMetadataItem* entry = NULL; 542 543 544 if (md == NULL) { 545 psError(__func__, "Null metadata collection not allowed"); 546 return NULL; 547 } 548 509 549 mdList = md->list; 510 550 if (mdList == NULL) { … … 516 556 entry = psListGetCurrent(mdList); 517 557 while (entry != NULL) { 518 if (!strncmp(match, entry->name, strlen(match))) { 519 520 // Match found 521 return entry; 522 } 523 entry = psListGetNext(mdList); 558 if(match != NULL) { 559 if (!strncmp(match, entry->name, strlen(match))) { 560 561 // Match found 562 return entry; 563 } 564 entry = psListGetPrevious(mdList); 565 } else { 566 return psListGetPrevious(mdList); 567 } 524 568 } 525 569 526 570 // Match not found 527 571 if (entry == NULL) { 528 psError(__func__, "Couldn't find metadata item with given match. Match: %s", match); 529 } 530 531 return entry; 532 } 533 534 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which) 535 { 536 psList* mdList = NULL; 537 psMetadataItem* entry = NULL; 538 539 mdList = md->list; 540 if (mdList == NULL) { 541 psError(__func__, "Null metadata list not allowed"); 542 return NULL; 543 } 544 545 mdList = md->list; 546 if (mdList == NULL) { 547 psError(__func__, "Null metadata list not allowed"); 548 return NULL; 549 } 550 551 psListSetIterator(mdList, which); 552 entry = psListGetCurrent(mdList); 553 while (entry != NULL) { 554 if (!strncmp(match, entry->name, strlen(match))) { 555 556 // Match found 557 return entry; 558 } 559 entry = psListGetPrevious(mdList); 560 } 561 562 // Match not found 563 if (entry == NULL) { 564 psError(__func__, "Couldn't find metadata item with given match. Match: %s", match); 572 psError(__func__, "Couldn't find metadata item", match); 565 573 } 566 574
Note:
See TracChangeset
for help on using the changeset viewer.
