This is an automated email from the ASF dual-hosted git repository.

yuanz pushed a commit to branch no-std
in repository 
https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git


The following commit(s) were added to refs/heads/no-std by this push:
     new 3177d4f  optee-utee: Add method to check if TransientObject is created 
with null handle
3177d4f is described below

commit 3177d4fa06f77afb351d0a19b8aa51b4a50fa1c8
Author: zengxiaobo <[email protected]>
AuthorDate: Fri Sep 13 12:10:20 2024 +0800

    optee-utee: Add method to check if TransientObject is created with null 
handle
    
    Signed-off-by: zengxiaobo <[email protected]>
---
 optee-utee/src/object.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/optee-utee/src/object.rs b/optee-utee/src/object.rs
index bd1432e..09fa461 100644
--- a/optee-utee/src/object.rs
+++ b/optee-utee/src/object.rs
@@ -224,6 +224,10 @@ impl ObjectHandle {
         unsafe { *(self.raw) }
     }
 
+    fn is_null(&self) -> bool {
+        self.raw.is_null()
+    }
+
     fn from_raw(raw: *mut raw::TEE_ObjectHandle) -> ObjectHandle {
         Self { raw }
     }
@@ -517,6 +521,15 @@ impl TransientObject {
         Self(ObjectHandle::from_raw(ptr::null_mut()))
     }
 
+    /// Check if current object is created with null handle.
+    ///
+    /// # See Also
+    ///
+    /// - [Self::null_object](Self::null_object).
+    pub fn is_null_object(&self) -> bool {
+        self.0.is_null()
+    }
+
     /// Allocate an uninitialized [TransientObject](TransientObject), i.e. a 
container for attributes.
     ///
     /// As allocated, the object is uninitialized.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to