diff options
| author | Paul Eggert | 2011-03-15 01:38:32 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-15 01:38:32 -0700 |
| commit | 38b2c0769fbfc40162fc8c39170fcb28bcf69520 (patch) | |
| tree | 38bc0551bde91deff6303719b46768bfd9f3c703 /src | |
| parent | 15206ed9236f4957cb62a0cfbd5397cf8f0cb76b (diff) | |
| download | emacs-38b2c0769fbfc40162fc8c39170fcb28bcf69520.tar.gz emacs-38b2c0769fbfc40162fc8c39170fcb28bcf69520.zip | |
* dired.c (directory_files_internal, file_name_completion):
Rename locals to avoid shadowing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/dired.c | 34 |
2 files changed, 20 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7e873e3d85d..6355d81ba40 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-03-15 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-03-15 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * dired.c (directory_files_internal, file_name_completion): | ||
| 4 | Rename locals to avoid shadowing. | ||
| 5 | |||
| 3 | Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254). | 6 | Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254). |
| 4 | An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in | 7 | An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in |
| 5 | dired.c's scmp function, had undefined behavior. | 8 | dired.c's scmp function, had undefined behavior. |
diff --git a/src/dired.c b/src/dired.c index 7891fc5f4a1..4080e1711e0 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -233,11 +233,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m | |||
| 233 | int len; | 233 | int len; |
| 234 | int wanted = 0; | 234 | int wanted = 0; |
| 235 | Lisp_Object name, finalname; | 235 | Lisp_Object name, finalname; |
| 236 | struct gcpro gcpro1, gcpro2; | 236 | struct gcpro inner_gcpro1, inner_gcpro2; |
| 237 | 237 | ||
| 238 | len = NAMLEN (dp); | 238 | len = NAMLEN (dp); |
| 239 | name = finalname = make_unibyte_string (dp->d_name, len); | 239 | name = finalname = make_unibyte_string (dp->d_name, len); |
| 240 | GCPRO2 (finalname, name); | 240 | GCPRO2_VAR (finalname, name, inner_gcpro); |
| 241 | 241 | ||
| 242 | /* Note: DECODE_FILE can GC; it should protect its argument, | 242 | /* Note: DECODE_FILE can GC; it should protect its argument, |
| 243 | though. */ | 243 | though. */ |
| @@ -293,23 +293,23 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m | |||
| 293 | /* Construct an expanded filename for the directory entry. | 293 | /* Construct an expanded filename for the directory entry. |
| 294 | Use the decoded names for input to Ffile_attributes. */ | 294 | Use the decoded names for input to Ffile_attributes. */ |
| 295 | Lisp_Object decoded_fullname, fileattrs; | 295 | Lisp_Object decoded_fullname, fileattrs; |
| 296 | struct gcpro gcpro1, gcpro2; | 296 | struct gcpro innermost_gcpro1, innermost_gcpro2; |
| 297 | 297 | ||
| 298 | decoded_fullname = fileattrs = Qnil; | 298 | decoded_fullname = fileattrs = Qnil; |
| 299 | GCPRO2 (decoded_fullname, fileattrs); | 299 | GCPRO2_VAR (decoded_fullname, fileattrs, innermost_gcpro); |
| 300 | 300 | ||
| 301 | /* Both Fexpand_file_name and Ffile_attributes can GC. */ | 301 | /* Both Fexpand_file_name and Ffile_attributes can GC. */ |
| 302 | decoded_fullname = Fexpand_file_name (name, directory); | 302 | decoded_fullname = Fexpand_file_name (name, directory); |
| 303 | fileattrs = Ffile_attributes (decoded_fullname, id_format); | 303 | fileattrs = Ffile_attributes (decoded_fullname, id_format); |
| 304 | 304 | ||
| 305 | list = Fcons (Fcons (finalname, fileattrs), list); | 305 | list = Fcons (Fcons (finalname, fileattrs), list); |
| 306 | UNGCPRO; | 306 | UNGCPRO_VAR (innermost_gcpro); |
| 307 | } | 307 | } |
| 308 | else | 308 | else |
| 309 | list = Fcons (finalname, list); | 309 | list = Fcons (finalname, list); |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | UNGCPRO; | 312 | UNGCPRO_VAR (inner_gcpro); |
| 313 | } | 313 | } |
| 314 | } | 314 | } |
| 315 | 315 | ||
| @@ -676,11 +676,11 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 676 | if (!NILP (predicate)) | 676 | if (!NILP (predicate)) |
| 677 | { | 677 | { |
| 678 | Lisp_Object val; | 678 | Lisp_Object val; |
| 679 | struct gcpro gcpro1; | 679 | struct gcpro inner_gcpro1; |
| 680 | 680 | ||
| 681 | GCPRO1 (name); | 681 | GCPRO1_VAR (name, inner_gcpro); |
| 682 | val = call1 (predicate, name); | 682 | val = call1 (predicate, name); |
| 683 | UNGCPRO; | 683 | UNGCPRO_VAR (inner_gcpro); |
| 684 | 684 | ||
| 685 | if (NILP (val)) | 685 | if (NILP (val)) |
| 686 | continue; | 686 | continue; |
| @@ -702,16 +702,16 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 702 | Lisp_Object zero = make_number (0); | 702 | Lisp_Object zero = make_number (0); |
| 703 | /* FIXME: This is a copy of the code in Ftry_completion. */ | 703 | /* FIXME: This is a copy of the code in Ftry_completion. */ |
| 704 | int compare = min (bestmatchsize, SCHARS (name)); | 704 | int compare = min (bestmatchsize, SCHARS (name)); |
| 705 | Lisp_Object tem | 705 | Lisp_Object cmp |
| 706 | = Fcompare_strings (bestmatch, zero, | 706 | = Fcompare_strings (bestmatch, zero, |
| 707 | make_number (compare), | 707 | make_number (compare), |
| 708 | name, zero, | 708 | name, zero, |
| 709 | make_number (compare), | 709 | make_number (compare), |
| 710 | completion_ignore_case ? Qt : Qnil); | 710 | completion_ignore_case ? Qt : Qnil); |
| 711 | int matchsize | 711 | int matchsize |
| 712 | = (EQ (tem, Qt) ? compare | 712 | = (EQ (cmp, Qt) ? compare |
| 713 | : XINT (tem) < 0 ? - XINT (tem) - 1 | 713 | : XINT (cmp) < 0 ? - XINT (cmp) - 1 |
| 714 | : XINT (tem) - 1); | 714 | : XINT (cmp) - 1); |
| 715 | 715 | ||
| 716 | if (completion_ignore_case) | 716 | if (completion_ignore_case) |
| 717 | { | 717 | { |
| @@ -735,18 +735,18 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 735 | (((matchsize == SCHARS (name)) | 735 | (((matchsize == SCHARS (name)) |
| 736 | == | 736 | == |
| 737 | (matchsize + !!directoryp == SCHARS (bestmatch))) | 737 | (matchsize + !!directoryp == SCHARS (bestmatch))) |
| 738 | && (tem = Fcompare_strings (name, zero, | 738 | && (cmp = Fcompare_strings (name, zero, |
| 739 | make_number (SCHARS (file)), | 739 | make_number (SCHARS (file)), |
| 740 | file, zero, | 740 | file, zero, |
| 741 | Qnil, | 741 | Qnil, |
| 742 | Qnil), | 742 | Qnil), |
| 743 | EQ (Qt, tem)) | 743 | EQ (Qt, cmp)) |
| 744 | && (tem = Fcompare_strings (bestmatch, zero, | 744 | && (cmp = Fcompare_strings (bestmatch, zero, |
| 745 | make_number (SCHARS (file)), | 745 | make_number (SCHARS (file)), |
| 746 | file, zero, | 746 | file, zero, |
| 747 | Qnil, | 747 | Qnil, |
| 748 | Qnil), | 748 | Qnil), |
| 749 | ! EQ (Qt, tem)))) | 749 | ! EQ (Qt, cmp)))) |
| 750 | bestmatch = name; | 750 | bestmatch = name; |
| 751 | } | 751 | } |
| 752 | bestmatchsize = matchsize; | 752 | bestmatchsize = matchsize; |