comparison src/alloc.c @ 83414:14a4eb789b45

Merged from miles@gnu.org--gnu-2005 (patch 169-173, 671-676) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-671 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-672 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-673 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-674 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-675 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-169 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-170 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-171 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-172 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-173 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-454
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 19 Dec 2005 19:57:22 +0000
parents 1955a4462bf9 28fd92314a04
children d2c799f58129
comparison
equal deleted inserted replaced
83413:e26e2265dcc6 83414:14a4eb789b45
4498 4498
4499 4499
4500 /* Return 1 if OBJ is a valid lisp object. 4500 /* Return 1 if OBJ is a valid lisp object.
4501 Return 0 if OBJ is NOT a valid lisp object. 4501 Return 0 if OBJ is NOT a valid lisp object.
4502 Return -1 if we cannot validate OBJ. 4502 Return -1 if we cannot validate OBJ.
4503 */ 4503 This function can be quite slow,
4504 so it should only be used in code for manual debugging. */
4504 4505
4505 int 4506 int
4506 valid_lisp_object_p (obj) 4507 valid_lisp_object_p (obj)
4507 Lisp_Object obj; 4508 Lisp_Object obj;
4508 { 4509 {
4524 /* We need to determine whether it is safe to access memory at 4525 /* We need to determine whether it is safe to access memory at
4525 address P. Obviously, we cannot just access it (we would SEGV 4526 address P. Obviously, we cannot just access it (we would SEGV
4526 trying), so we trick the o/s to tell us whether p is a valid 4527 trying), so we trick the o/s to tell us whether p is a valid
4527 pointer. Unfortunately, we cannot use NULL_DEVICE here, as 4528 pointer. Unfortunately, we cannot use NULL_DEVICE here, as
4528 emacs_write may not validate p in that case. */ 4529 emacs_write may not validate p in that case. */
4529 if ((fd = emacs_open("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0) 4530 if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0)
4530 { 4531 {
4531 int valid = emacs_write(fd, (char *)p, 16) == 16; 4532 int valid = (emacs_write (fd, (char *)p, 16) == 16);
4532 emacs_close(fd); 4533 emacs_close (fd);
4533 unlink("__Valid__Lisp__Object__"); 4534 unlink ("__Valid__Lisp__Object__");
4534 return valid; 4535 return valid;
4535 } 4536 }
4536 4537
4537 return -1; 4538 return -1;
4538 #else 4539 #else