diff options
| author | Paul Eggert | 2016-01-30 14:20:57 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-01-30 15:26:07 -0800 |
| commit | e1a9f2099c2e683dffc4b898ce85ce935c4cb254 (patch) | |
| tree | 14f8b080fb8515b81111dc269e37aa01f73b16fc /src/sysdep.c | |
| parent | 874c59a81b7ee12a739149c5229e6d3bbd463324 (diff) | |
| download | emacs-e1a9f2099c2e683dffc4b898ce85ce935c4cb254.tar.gz emacs-e1a9f2099c2e683dffc4b898ce85ce935c4cb254.zip | |
Pacify --enable-gcc-warnings when HYBRID_MALLOC
* src/buffer.c (init_buffer):
* src/emacs.c (main):
* src/xsmfns.c (smc_save_yourself_CB, x_session_initialize):
Use emacs_get_current_dir_name, not get_current_dir_name.
* src/conf_post.h (aligned_alloc) [HYBRID_MALLOC && emacs]: New macro.
(HYBRID_GET_CURRENT_DIR_NAME, get_current_dir_name): Remove.
* src/emacs.c: Include "sheap.h".
(report_sheap_usage): Remove decl.
(Fdump_emacs) [HYBRID_MALLOC]: Report usage directly.
Don't assume ptrdiff_t can be printed as int.
* src/gmalloc.c [HYBRID_MALLOC]:
Include "sheap.h" rather than declaring its contents by hand.
(get_current_dir_name, gget_current_dir_name)
(hybrid_get_current_dir_name): Remove.
(emacs_abort): Remove duplicate decl.
(aligned_alloc): Undef, like malloc etc.
(ALLOCATED_BEFORE_DUMPING): Now a static function, not a macro.
Make it a bit more efficient.
(malloc_find_object_address): Remove unused decl.
(enum mcheck_status, mcheck, mprobe, mtrace, muntrace, struct mstats)
(mstats, memory_warnings): Declare only if GC_MCHECK.
* src/lisp.h (emacs_get_current_dir_name):
New decl, replacing get_current_dir_name.
* src/sheap.c: Include sheap.h first.
(STATIC_HEAP_SIZE): Remove; now in sheap.h.
(debug_sheap): Now static.
(bss_sbrk_buffer_end): Remove; no longer used.
(bss_sbrk_ptr): Now static and private.
(bss_sbrk_did_unexec): Now bool.
(BLOCKSIZE): Remove, to avoid GCC warning about its not being used.
(bss_sbrk): Don't treat request_size 0 as special, since the code
works without this being a special case.
Avoid overflow if request size exceeds INT_MAX.
(report_sheap_usage): Remove; now done in emacs.c.
* src/sheap.h: New file.
* src/sysdep.c (get_current_dir_name): Remove macro.
Include "sheap.h".
(emacs_get_current_dir_name): Rename function from
get_current_dir_name. Handle HYBRID_MALLOC here;
this is simpler.
(Bug#22086)
Diffstat (limited to 'src/sysdep.c')
| -rw-r--r-- | src/sysdep.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 19a7212f7e2..418c50d5e78 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -19,14 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | 21 | ||
| 22 | /* If HYBRID_GET_CURRENT_DIR_NAME is defined in conf_post.h, then we | ||
| 23 | need the following before including unistd.h, in order to pick up | ||
| 24 | the right prototype for gget_current_dir_name. */ | ||
| 25 | #ifdef HYBRID_GET_CURRENT_DIR_NAME | ||
| 26 | #undef get_current_dir_name | ||
| 27 | #define get_current_dir_name gget_current_dir_name | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #include <execinfo.h> | 22 | #include <execinfo.h> |
| 31 | #include "sysstdio.h" | 23 | #include "sysstdio.h" |
| 32 | #ifdef HAVE_PWD_H | 24 | #ifdef HAVE_PWD_H |
| @@ -40,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 40 | #include <utimens.h> | 32 | #include <utimens.h> |
| 41 | 33 | ||
| 42 | #include "lisp.h" | 34 | #include "lisp.h" |
| 35 | #include "sheap.h" | ||
| 43 | #include "sysselect.h" | 36 | #include "sysselect.h" |
| 44 | #include "blockinput.h" | 37 | #include "blockinput.h" |
| 45 | 38 | ||
| @@ -137,14 +130,21 @@ static const int baud_convert[] = | |||
| 137 | 1800, 2400, 4800, 9600, 19200, 38400 | 130 | 1800, 2400, 4800, 9600, 19200, 38400 |
| 138 | }; | 131 | }; |
| 139 | 132 | ||
| 140 | #if !defined HAVE_GET_CURRENT_DIR_NAME || defined BROKEN_GET_CURRENT_DIR_NAME \ | 133 | /* Return the current working directory. The result should be freed |
| 141 | || (defined HYBRID_GET_CURRENT_DIR_NAME) | 134 | with 'free'. Return NULL on errors. */ |
| 142 | /* Return the current working directory. Returns NULL on errors. | ||
| 143 | Any other returned value must be freed with free. This is used | ||
| 144 | only when get_current_dir_name is not defined on the system. */ | ||
| 145 | char * | 135 | char * |
| 146 | get_current_dir_name (void) | 136 | emacs_get_current_dir_name (void) |
| 147 | { | 137 | { |
| 138 | # if HAVE_GET_CURRENT_DIR_NAME && !BROKEN_GET_CURRENT_DIR_NAME | ||
| 139 | # ifdef HYBRID_MALLOC | ||
| 140 | bool use_libc = bss_sbrk_did_unexec; | ||
| 141 | # else | ||
| 142 | bool use_libc = true; | ||
| 143 | # endif | ||
| 144 | if (use_libc) | ||
| 145 | return get_current_dir_name (); | ||
| 146 | # endif | ||
| 147 | |||
| 148 | char *buf; | 148 | char *buf; |
| 149 | char *pwd = getenv ("PWD"); | 149 | char *pwd = getenv ("PWD"); |
| 150 | struct stat dotstat, pwdstat; | 150 | struct stat dotstat, pwdstat; |
| @@ -192,7 +192,6 @@ get_current_dir_name (void) | |||
| 192 | } | 192 | } |
| 193 | return buf; | 193 | return buf; |
| 194 | } | 194 | } |
| 195 | #endif | ||
| 196 | 195 | ||
| 197 | 196 | ||
| 198 | /* Discard pending input on all input descriptors. */ | 197 | /* Discard pending input on all input descriptors. */ |