aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 668bbc75947..6bc1b8afe17 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1375,8 +1375,8 @@ lisp_align_free (void *block)
1375static bool 1375static bool
1376laligned (void *p, size_t size) 1376laligned (void *p, size_t size)
1377{ 1377{
1378 return (MALLOC_IS_GC_ALIGNED || size % GCALIGNMENT != 0 1378 return (MALLOC_IS_GC_ALIGNED || (intptr_t) p % GCALIGNMENT == 0
1379 || (intptr_t) p % GCALIGNMENT == 0); 1379 || size % GCALIGNMENT != 0);
1380} 1380}
1381 1381
1382/* Like malloc and realloc except that if SIZE is Lisp-aligned, make 1382/* Like malloc and realloc except that if SIZE is Lisp-aligned, make
@@ -1385,7 +1385,15 @@ laligned (void *p, size_t size)
1385 Lisp-aligned pointer. Code that needs to allocate C heap memory 1385 Lisp-aligned pointer. Code that needs to allocate C heap memory
1386 for a Lisp object should use one of these functions to obtain a 1386 for a Lisp object should use one of these functions to obtain a
1387 pointer P; that way, if T is an enum Lisp_Type value and L == 1387 pointer P; that way, if T is an enum Lisp_Type value and L ==
1388 make_lisp_ptr (P, T), then XPNTR (L) == P and XTYPE (L) == T. */ 1388 make_lisp_ptr (P, T), then XPNTR (L) == P and XTYPE (L) == T.
1389
1390 On typical modern platforms these functions' loops do not iterate.
1391 On now-rare (and perhaps nonexistent) platforms, the loops in
1392 theory could repeat forever. If an infinite loop is possible on a
1393 platform, a build would surely loop and the builder can then send
1394 us a bug report. Adding a counter to try to detect any such loop
1395 would complicate the code (and possibly introduce bugs, in code
1396 that's never really exercised) for little benefit. */
1389 1397
1390static void * 1398static void *
1391lmalloc (size_t size) 1399lmalloc (size_t size)