Changeset 4642

Show
Ignore:
Timestamp:
07/22/07 14:51:57 (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/branches/lm-sensors-3.0.0
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/CHANGES

    r4636 r4642  
    1717           Drop all the chip-specific support 
    1818           Fix a memory leak on error 
     19           Speed up sensors_get_ignored() a bit 
    1920  Makefile: Drop the package and version targets 
    2021  Man page sensors.conf.5: Update the chip statement section 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/access.c

    r4637 r4642  
    199199        const sensors_chip_feature *featureptr; 
    200200        const sensors_chip_feature *alt_featureptr; 
    201         int i, res; 
    202  
    203         /* Default: valid */ 
    204         res = 1; 
     201        int i; 
     202 
    205203        if (sensors_chip_name_has_wildcards(name)) 
    206204                return -SENSORS_ERR_WILDCARDS; 
     
    215213        for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) 
    216214                for (i = 0; i < chip->ignores_count; i++) 
    217                         if (!strcasecmp(featureptr->data.name, chip->ignores[i].name)) 
    218                                 return 0; /* Exact match always overrules! */ 
    219                         else if (alt_featureptr && 
    220                                  !strcasecmp(alt_featureptr->data.name, 
    221                                              chip->ignores[i].name)) 
    222                                 res = 0; 
    223         return res; 
     215                        if (!strcasecmp(featureptr->data.name, chip->ignores[i].name) || 
     216                            (alt_featureptr && 
     217                             !strcasecmp(alt_featureptr->data.name, chip->ignores[i].name))) 
     218                                return 0; 
     219        /* valid */ 
     220        return 1; 
    224221} 
    225222