IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7911


Ignore:
Timestamp:
Jul 14, 2006, 4:37:47 PM (20 years ago)
Author:
Paul Price
Message:

Fixes for psMetadataIterator with a regex. See bugs 777, 778.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psMetadata.c

    r7766 r7911  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.115 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-06-30 02:20:06 $
     14 *  @version $Revision: 1.116 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-07-15 02:37:47 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    127127    if (iter->regex != NULL) {
    128128        regfree(iter->regex);
     129        psFree(iter->regex);
    129130    }
    130131}
     
    918919    psMemSetDeallocator(newIter, (psFreeFunc) metadataIteratorFree);
    919920
    920     if (regex == NULL) {
    921         newIter->iter = psListIteratorAlloc(md->list, location, false);
    922         return newIter;
    923     } else {
     921    newIter->iter = psListIteratorAlloc(md->list, location, false);
     922
     923    if (regex) {
     924        newIter->regex = psAlloc(sizeof(regex_t));
    924925        int regRtn = regcomp(newIter->regex,regex,0);
    925926        if (regRtn != 0) {
     
    934935        }
    935936    }
    936 
    937     psMetadataIteratorSet(newIter, location); // XXX: do we error if no match is found?
    938937
    939938    return newIter;
     
    10111010    while (psListGetAndIncrement(iter) != NULL) {
    10121011        if (iter->cursor != NULL &&
    1013                 regexec(regex, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
     1012                regexec(regex, ((psMetadataItem*)iter->cursor->data)->name, 0, NULL, 0) == 0) {
    10141013            // this key is a match
    10151014            break;
Note: See TracChangeset for help on using the changeset viewer.