summaryrefslogtreecommitdiff
path: root/libguile/eq.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-09-23 10:55:24 +0200
committerLudovic Courtès <ludo@gnu.org>2010-09-23 21:55:21 +0200
commitcb2d8076effd1b3f0a01a7148af5a97b64f4c29d (patch)
tree36b07bd16ef8d83fbcf40ca67141d8402617ac56 /libguile/eq.c
parentfb5c4dc52337603e7526a1f944533ce8217a9e29 (diff)
downloadguile-cb2d8076effd1b3f0a01a7148af5a97b64f4c29d.tar.gz
Define `equal?' for pointer objects.
* libguile/eq.c (scm_equal_p): Handle pointer objects. * test-suite/tests/foreign.test ("make-pointer")["equal?", "equal? modulo finalizer", "not equal?"]: New tests.
Diffstat (limited to 'libguile/eq.c')
-rw-r--r--libguile/eq.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libguile/eq.c b/libguile/eq.c
index 923fa77a1..75025598c 100644
--- a/libguile/eq.c
+++ b/libguile/eq.c
@@ -303,6 +303,9 @@ scm_equal_p (SCM x, SCM y)
else
goto generic_equal;
}
+ if (SCM_POINTER_P (x) && SCM_POINTER_P (y))
+ return scm_from_bool (SCM_POINTER_VALUE (x) == SCM_POINTER_VALUE (y));
+
/* This ensures that types and scm_length are the same. */
if (SCM_CELL_TYPE (x) != SCM_CELL_TYPE (y))
{