diff libpam-sys/src/helpers.rs @ 117:20f7712a6857

Neaten up libpam-sys BinaryPayload buffer management.
author Paul Fisher <paul@pfish.zone>
date Sun, 29 Jun 2025 18:48:14 -0400
parents 2346fd501b7a
children 39760dfc9b3b
line wrap: on
line diff
--- a/libpam-sys/src/helpers.rs	Sun Jun 29 18:27:51 2025 -0400
+++ b/libpam-sys/src/helpers.rs	Sun Jun 29 18:48:14 2025 -0400
@@ -133,12 +133,7 @@
     /// The total bytes needed to store this, including the header.
     pub fn total_bytes(&self) -> usize {
         unsafe {
-            self.0
-                .as_ptr()
-                .cast::<BinaryPayload>()
-                .as_ref()
-                .unwrap_unchecked()
-                .total_bytes()
+            BinaryPayload::buffer_of(self.0.as_ptr().cast()).len()
         }
     }