Subject: bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 12 Dec 2021 07:12:16 +0100

[email-masked] writes:

> -OPTION_DEFAULT_ON([sqlite3],[don't compile with sqlite3 support])
> +OPTION_DEFAULT_OFF([sqlite3],[don't compile with sqlite3 support])

No, we're defaulting it to on.

> -     AC_SUBST(SQLITE3_LIBS)
> -     LIBS="$SQLITE3_LIBS $LIBS"
> +     SQLITE3_OBJ=sqlite.o

No, we're always building the sqlite.o file.  We've tried out different
variants of this over the years, but always compiling the files (and
if-deffing out almost everything in it) is the least work in the long
run.

> diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el
> index 9306bd85dcd..823dfeb07d6 100644
> --- a/lisp/sqlite-mode.el
> +++ b/lisp/sqlite-mode.el
> @@ -25,6 +25,14 @@
>  
>  (require 'cl-lib)
>  
> +(declare-function sqlite-execute "sqlite.c")
> +(declare-function sqlite-more-p "sqlite.c")
> +(declare-function sqlite-next "sqlite.c")
> +(declare-function sqlite-columns "sqlite.c")
> +(declare-function sqlite-finalize "sqlite.c")
> +(declare-function sqlite-select "sqlite.c")
> +(declare-function sqlite-open "sqlite.c")

Thanks; applied.

> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -2571,17 +2571,6 @@ xmint_pointer (Lisp_Object a)
>    return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Misc_Ptr)->pointer;
>  }
>  
> -struct Lisp_Sqlite
> -{
> -  union vectorlike_header header;
> -  void *db;
> -  void *stmt;
> -  char *name;
> -  void (*finalizer) (void *);
> -  bool eof;
> -  bool is_statement;
> -} GCALIGNED_STRUCT;

I thought including this in lisp.h instead of adding a separate .h and
#ifdeffing all over the place was the most readable, but I have no
strong opinion on that.  Eli, what do you think?

> --- a/test/src/sqlite-tests.el
> +++ b/test/src/sqlite-tests.el
> @@ -25,6 +25,17 @@
>  
>  (require 'ert)
>  (require 'ert-x)
> +(require 'sqlite-mode)

I don't think this file is testing anything in sqlite-mode?

> +(declare-function sqlite-execute "sqlite.c")
> +(declare-function sqlite-close "sqlite.c")
> +(declare-function sqlitep "sqlite.c")
> +(declare-function sqlite-available-p "sqlite.c")
> +(declare-function sqlite-finalize "sqlite.c")
> +(declare-function sqlite-next "sqlite.c")
> +(declare-function sqlite-more-p "sqlite.c")
> +(declare-function sqlite-select "sqlite.c")
> +(declare-function sqlite-open "sqlite.c")

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no