From ed7434e95852f14e3a8683927a136e4daa8ffa9e Mon Sep 17 00:00:00 2001
From: gwenn <gtreguier@gmail.com>
Date: Sun, 24 Mar 2024 07:57:24 +0100
Subject: [PATCH] Use C-string literals

---
 src/lib.rs        | 4 ++--
 src/vtab/array.rs | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs
index c839b8f..7572908 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -364,7 +364,7 @@ impl DatabaseName<'_> {
     fn as_cstring(&self) -> Result<SmallCString> {
         use self::DatabaseName::{Attached, Main, Temp};
         match *self {
-            Main => str_to_cstring("main"),
+            Main => str_to_cstring("main"), // TODO C-string literals
             Temp => str_to_cstring("temp"),
             Attached(s) => str_to_cstring(s),
         }
@@ -1908,7 +1908,7 @@ mod test {
     #[test]
     fn test_from_handle_owned() -> Result<()> {
         let mut handle: *mut ffi::sqlite3 = std::ptr::null_mut();
-        let r = unsafe { ffi::sqlite3_open(":memory:\0".as_ptr() as *const c_char, &mut handle) };
+        let r = unsafe { ffi::sqlite3_open(c":memory:".as_ptr(), &mut handle) };
         assert_eq!(r, ffi::SQLITE_OK);
         let db = unsafe { Connection::from_handle_owned(handle) }?;
         db.execute_batch("PRAGMA VACUUM")?;
diff --git a/src/vtab/array.rs b/src/vtab/array.rs
index ca54b24..004d91a 100644
--- a/src/vtab/array.rs
+++ b/src/vtab/array.rs
@@ -40,7 +40,7 @@ use crate::{Connection, Result};
 
 // http://sqlite.org/bindptr.html
 
-pub(crate) const ARRAY_TYPE: *const c_char = (b"rarray\0" as *const u8).cast::<c_char>();
+pub(crate) const ARRAY_TYPE: *const c_char = c"rarray".as_ptr();
 
 pub(crate) unsafe extern "C" fn free_array(p: *mut c_void) {
     drop(Rc::from_raw(p as *const Vec<Value>));