emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 17569c9 1/3: Fix Fsqlite_finalize book-keeping


From: Lars Ingebrigtsen
Subject: master 17569c9 1/3: Fix Fsqlite_finalize book-keeping
Date: Sat, 11 Dec 2021 02:18:14 -0500 (EST)

branch: master
commit 17569c94954dc1d9d47155a8ca987d8ff4855180
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix Fsqlite_finalize book-keeping
    
    * src/sqlite.c (Fsqlite_finalize): Mark the object as dead.
---
 src/sqlite.c             | 3 ++-
 test/src/sqlite-tests.el | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/sqlite.c b/src/sqlite.c
index 42a7a3a..c1f3e7b 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -290,7 +290,7 @@ DEFUN ("sqlite-close", Fsqlite_close, Ssqlite_close, 1, 1, 
0,
   check_sqlite (db, false);
   sqlite3_close (XSQLITE (db)->db);
   XSQLITE (db)->db = NULL;
-  return Qnil;
+  return Qt;
 }
 
 /* Bind values in a statement like
@@ -647,6 +647,7 @@ This will free the resources held by SET.  */)
 {
   check_sqlite (set, true);
   sqlite3_finalize (XSQLITE (set)->stmt);
+  XSQLITE (set)->db = NULL;
   return Qt;
 }
 
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index 412ea29..7ccea1c 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -79,7 +79,9 @@
     (should (equal (sqlite-next set)
                    '("bar" 2)))
     (should-not (sqlite-next set))
-    (should-not (sqlite-more-p set))))
+    (should-not (sqlite-more-p set))
+    (sqlite-finalize set)
+    (should-error (sqlite-next set))))
 
 (ert-deftest sqlite-chars ()
   (skip-unless (sqlite-available-p))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]