Changeset 4640

Show
Ignore:
Timestamp:
07/22/07 14:45:43 (7 years ago)
Author:
khali
Message:

Speed up sensors_get_ignored() a bit. We can return as soon as an ignore
statement is found to match, even if it isn't an exact match.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r4635 r4640  
    44SVN HEAD 
    55  Library: Fix a memory leak on error 
     6           Speed up sensors_get_ignored() a bit 
    67  Module i2c-piix4: Add ATI SB700 support (2.6 backport) 
    78 
  • lm-sensors/trunk/lib/access.c

    r4551 r4640  
    197197        const sensors_chip_feature *featureptr; 
    198198        const sensors_chip_feature *alt_featureptr; 
    199         int i, res; 
    200  
    201         /* Default: valid */ 
    202         res = 1; 
     199        int i; 
     200 
    203201        if (sensors_chip_name_has_wildcards(name)) 
    204202                return -SENSORS_ERR_WILDCARDS; 
     
    213211        for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) 
    214212                for (i = 0; i < chip->ignores_count; i++) 
    215                         if (!strcasecmp(featureptr->data.name, chip->ignores[i].name)) 
    216                                 return 0; /* Exact match always overrules! */ 
    217                         else if (alt_featureptr && 
    218                                  !strcasecmp(alt_featureptr->data.name, 
    219                                              chip->ignores[i].name)) 
    220                                 res = 0; 
    221         return res; 
     213                        if (!strcasecmp(featureptr->data.name, chip->ignores[i].name) || 
     214                            (alt_featureptr && 
     215                             !strcasecmp(alt_featureptr->data.name, chip->ignores[i].name))) 
     216                                return 0; 
     217        /* valid */ 
     218        return 1; 
    222219} 
    223220