diff options
| author | Miles Bader | 2006-03-10 23:46:54 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-03-10 23:46:54 +0000 |
| commit | 57216976c5a20643ba59f8436e1177f66eb17cb7 (patch) | |
| tree | d8210e4d5d8e8502635922addf9355ccd6bf21e2 /src/alloc.c | |
| parent | d959f5123e8ac52035c899704954dfcf426529c9 (diff) | |
| parent | ea8ae7654a60bf4598a6b6269fe75fb859b91651 (diff) | |
| download | emacs-57216976c5a20643ba59f8436e1177f66eb17cb7.tar.gz emacs-57216976c5a20643ba59f8436e1177f66eb17cb7.zip | |
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-42
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 144-147)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 56)
- Update from CVS
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c index ea52c98fd24..549f14625e6 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -883,6 +883,12 @@ lisp_free (block) | |||
| 883 | /* The entry point is lisp_align_malloc which returns blocks of at most */ | 883 | /* The entry point is lisp_align_malloc which returns blocks of at most */ |
| 884 | /* BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary. */ | 884 | /* BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary. */ |
| 885 | 885 | ||
| 886 | /* Use posix_memalloc if the system has it and we're using the system's | ||
| 887 | malloc (because our gmalloc.c routines don't have posix_memalign although | ||
| 888 | its memalloc could be used). */ | ||
| 889 | #if defined (HAVE_POSIX_MEMALIGN) && defined (SYSTEM_MALLOC) | ||
| 890 | #define USE_POSIX_MEMALIGN 1 | ||
| 891 | #endif | ||
| 886 | 892 | ||
| 887 | /* BLOCK_ALIGN has to be a power of 2. */ | 893 | /* BLOCK_ALIGN has to be a power of 2. */ |
| 888 | #define BLOCK_ALIGN (1 << 10) | 894 | #define BLOCK_ALIGN (1 << 10) |
| @@ -948,7 +954,7 @@ struct ablocks | |||
| 948 | #define ABLOCKS_BUSY(abase) ((abase)->blocks[0].abase) | 954 | #define ABLOCKS_BUSY(abase) ((abase)->blocks[0].abase) |
| 949 | 955 | ||
| 950 | /* Pointer to the (not necessarily aligned) malloc block. */ | 956 | /* Pointer to the (not necessarily aligned) malloc block. */ |
| 951 | #ifdef HAVE_POSIX_MEMALIGN | 957 | #ifdef USE_POSIX_MEMALIGN |
| 952 | #define ABLOCKS_BASE(abase) (abase) | 958 | #define ABLOCKS_BASE(abase) (abase) |
| 953 | #else | 959 | #else |
| 954 | #define ABLOCKS_BASE(abase) \ | 960 | #define ABLOCKS_BASE(abase) \ |
| @@ -989,7 +995,7 @@ lisp_align_malloc (nbytes, type) | |||
| 989 | mallopt (M_MMAP_MAX, 0); | 995 | mallopt (M_MMAP_MAX, 0); |
| 990 | #endif | 996 | #endif |
| 991 | 997 | ||
| 992 | #ifdef HAVE_POSIX_MEMALIGN | 998 | #ifdef USE_POSIX_MEMALIGN |
| 993 | { | 999 | { |
| 994 | int err = posix_memalign (&base, BLOCK_ALIGN, ABLOCKS_BYTES); | 1000 | int err = posix_memalign (&base, BLOCK_ALIGN, ABLOCKS_BYTES); |
| 995 | if (err) | 1001 | if (err) |
| @@ -1105,7 +1111,7 @@ lisp_align_free (block) | |||
| 1105 | } | 1111 | } |
| 1106 | eassert ((aligned & 1) == aligned); | 1112 | eassert ((aligned & 1) == aligned); |
| 1107 | eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1)); | 1113 | eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1)); |
| 1108 | #ifdef HAVE_POSIX_MEMALIGN | 1114 | #ifdef USE_POSIX_MEMALIGN |
| 1109 | eassert ((unsigned long)ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0); | 1115 | eassert ((unsigned long)ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0); |
| 1110 | #endif | 1116 | #endif |
| 1111 | free (ABLOCKS_BASE (abase)); | 1117 | free (ABLOCKS_BASE (abase)); |