diff options
| author | Paul Eggert | 2023-08-07 21:23:28 -0700 |
|---|---|---|
| committer | Paul Eggert | 2023-08-07 21:26:36 -0700 |
| commit | 85b6c150c8a356ebf3442fde2836364954aa938c (patch) | |
| tree | 0ea86860bb95571114c9a14a45a77b34f123bac6 /src/comp.c | |
| parent | a579739e2b3f3c7218b14a7e41b78e7ddbded06c (diff) | |
| download | emacs-85b6c150c8a356ebf3442fde2836364954aa938c.tar.gz emacs-85b6c150c8a356ebf3442fde2836364954aa938c.zip | |
Fix some emacs_fopen confusion
Problem reported by Po Lu in:
https://lists.gnu.org/r/emacs-devel/2023-08/msg00195.html
* src/comp.c (comp_hash_source_file, Fcomp__release_ctxt):
* src/sysdep.c (get_up_time, procfs_ttyname, procfs_get_total_memory):
Be more systematic about using emacs_fclose on streams that were
opened with emacs_fopen or emacs_fdopen. Do this even if not
Android, as this simplifies checking that it's done consistently.
* src/lisp.h (emacs_fclose): If it’s just fclose,
make it a macro rather than a function, to avoid confusing gcc
-Wmismatched-dealloc.
(emacs_fopen): Move decl here from sysstdio.h, because sysstdio.h
is included from non-Emacs executables and emacs_fopen is good
only inside Emacs.
* src/sysdep.c (emacs_fclose): Define as a function only if Android.
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/comp.c b/src/comp.c index 1bde4ae5821..b81a80b00f8 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -776,7 +776,7 @@ comp_hash_source_file (Lisp_Object filename) | |||
| 776 | #else | 776 | #else |
| 777 | int res = md5_stream (f, SSDATA (digest)); | 777 | int res = md5_stream (f, SSDATA (digest)); |
| 778 | #endif | 778 | #endif |
| 779 | fclose (f); | 779 | emacs_fclose (f); |
| 780 | 780 | ||
| 781 | if (res) | 781 | if (res) |
| 782 | xsignal2 (Qfile_notify_error, build_string ("hashing failed"), filename); | 782 | xsignal2 (Qfile_notify_error, build_string ("hashing failed"), filename); |
| @@ -4749,7 +4749,7 @@ DEFUN ("comp--release-ctxt", Fcomp__release_ctxt, Scomp__release_ctxt, | |||
| 4749 | gcc_jit_context_release (comp.ctxt); | 4749 | gcc_jit_context_release (comp.ctxt); |
| 4750 | 4750 | ||
| 4751 | if (logfile) | 4751 | if (logfile) |
| 4752 | fclose (logfile); | 4752 | emacs_fclose (logfile); |
| 4753 | comp.ctxt = NULL; | 4753 | comp.ctxt = NULL; |
| 4754 | 4754 | ||
| 4755 | return Qt; | 4755 | return Qt; |