Changeset 4861

Show
Ignore:
Timestamp:
09/23/07 23:23:12 (1 year ago)
Author:
khali
Message:

Use strchr() and strrchr() instead of the deprecated index() and rindex().
Patch from Bernhard Fischer.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/lib/proc.c

    r4751 r4861  
    9494    if (strlen(line) > 0) 
    9595      line[strlen(line)-1] = '\0'; 
    96     if (! (border = rindex(line,'\t'))) 
     96    if (! (border = strrchr(line,'\t'))) 
    9797      goto ERROR; 
    9898    /* Skip algorithm name */ 
    9999    *border='\0'; 
    100     if (! (border = rindex(line,'\t'))) 
     100    if (! (border = strrchr(line,'\t'))) 
    101101      goto ERROR; 
    102102    if (! (entry.adapter = strdup(border + 1))) 
    103103      goto FAT_ERROR; 
    104104    *border='\0'; 
    105     if (! (border = rindex(line,'\t'))) 
     105    if (! (border = strrchr(line,'\t'))) 
    106106      goto ERROR; 
    107107    *border='\0'; 
     
    156156                strcat(n, "/"); 
    157157                strcpy(altn, n); 
    158                 /* use rindex to append sysname to n */ 
    159                 getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); 
     158                /* use strrchr to append sysname to n */ 
     159                getsysname(the_feature, strrchr(n, '\0'), &mag, strrchr(altn, '\0')); 
    160160                if ((f = fopen(n, "r")) != NULL 
    161161                 || (f = fopen(altn, "r")) != NULL) { 
     
    199199                strcat(n, "/"); 
    200200                strcpy(altn, n); 
    201                 /* use rindex to append sysname to n */ 
    202                 getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); 
     201                /* use strrchr to append sysname to n */ 
     202                getsysname(the_feature, strrchr(n, '\0'), &mag, strrchr(altn, '\0')); 
    203203                if ((f = fopen(n, "w")) != NULL 
    204204                 || (f = fopen(altn, "w")) != NULL) { 
  • lm-sensors/trunk/prog/dump/i2cbusses.c

    r4432 r4861  
    186186                                continue; 
    187187                        } 
    188                         if((border = index(x, '\n')) != NULL) 
     188                        if((border = strchr(x, '\n')) != NULL) 
    189189                                *border = 0; 
    190190                        if(count++ == 0 && !procfmt)