From 17fed6fefc2754998285a30898a4828293e83099 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 27 May 2006 19:00:36 +0000 Subject: * thread.cc (verifyable_object_isvalid): Check for NULL specifically. --- winsup/cygwin/thread.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/thread.cc') diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index ad9061952..08eb10dd2 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -113,15 +113,17 @@ __cygwin_lock_unlock (_LOCK_T *lock) } static inline verifyable_object_state -verifyable_object_isvalid (void const * objectptr, long magic, void *static_ptr1, +verifyable_object_isvalid (void const *objectptr, long magic, void *static_ptr1, void *static_ptr2, void *static_ptr3) { - verifyable_object **object = (verifyable_object **) objectptr; - myfault efault; - if (efault.faulted ()) + /* Check for NULL pointer specifically since it is a cheap test and avoids the + overhead of setting up the fault handler. */ + if (!objectptr || efault.faulted ()) return INVALID_OBJECT; + verifyable_object **object = (verifyable_object **) objectptr; + if ((static_ptr1 && *object == static_ptr1) || (static_ptr2 && *object == static_ptr2) || (static_ptr3 && *object == static_ptr3)) -- cgit v1.2.3