unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: "Alan Third" <athird@googlemail.com>,
	"Mattias Engdegård" <mattiase@acm.org>,
	emacs-devel@gnu.org
Subject: Re: Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration of function 'openat'
Date: Sun, 17 Apr 2022 16:21:40 -0700	[thread overview]
Message-ID: <2a4af68e-a6d3-e0f4-9100-1ca541f17c56@cs.ucla.edu> (raw)
In-Reply-To: <m21qxv9xvy.wl%esq@lawlist.com>

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

On 4/17/22 14:57, Keith David Bershatsky wrote:
> Using the master branch as of the most recent commit (6cd43d62055c9ec27cacdcaff13d4a52b7efdff2), with OSX 10.6.8 (Xcode 3.2.6), ./configure --with-gnutls=ifavailable, the build process stops before it gets to nsterm.m:
> 
>    CC       sqlite.o
> sqlite.c: In function 'Fsqlite_open':
> sqlite.c:265: error: 'SQLITE_OPEN_MEMORY' undeclared (first use in this function)

Does the attached fix that for you? (This also fixes a memory leak.)

[-- Attachment #2: sqlite.diff --]
[-- Type: text/x-patch, Size: 2016 bytes --]

diff --git a/src/sqlite.c b/src/sqlite.c
index 1ca8669931..7388b576e9 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -240,38 +240,36 @@ DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 1, 0,
 If FILE is nil, an in-memory database will be opened instead.  */)
   (Lisp_Object file)
 {
-  char *name;
+  Lisp_Object name;
+  int flags = (SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX
+	       | SQLITE_OPEN_READWRITE);
+#ifdef SQLITE_OPEN_URI
+  flags |= SQLITE_OPEN_URI;
+#endif
+
   if (!init_sqlite_functions ())
     xsignal1 (Qerror, build_string ("sqlite support is not available"));
 
   if (!NILP (file))
+    name = ENCODE_FILE (Fexpand_file_name (file, Qnil));
+  else
     {
-      CHECK_STRING (file);
-      file = ENCODE_FILE (Fexpand_file_name (file, Qnil));
-      name = xstrdup (SSDATA (file));
+#ifdef SQLITE_OPEN_MEMORY
+      /* In-memory database.  These have to have different names to
+	 refer to different databases.  */
+      AUTO_STRING (memory_fmt, ":memory:%d");
+      name = CALLN (Fformat, memory_fmt, make_int (++db_count));
+      flags |= SQLITE_OPEN_MEMORY;
+#else
+      xsignal1 (Qerror, build_string ("sqlite in-memory is not available"));
+#endif
     }
-  else
-    /* In-memory database.  These have to have different names to
-       refer to different databases.  */
-    name = xstrdup (SSDATA (CALLN (Fformat, build_string (":memory:%d"),
-				   make_int (++db_count))));
 
   sqlite3 *sdb;
-  int ret = sqlite3_open_v2 (name,
-			     &sdb,
-			     SQLITE_OPEN_FULLMUTEX
-			     | SQLITE_OPEN_READWRITE
-			     | SQLITE_OPEN_CREATE
-			     | (NILP (file) ? SQLITE_OPEN_MEMORY : 0)
-#ifdef SQLITE_OPEN_URI
-			     | SQLITE_OPEN_URI
-#endif
-			     | 0, NULL);
-
-  if (ret != SQLITE_OK)
+  if (sqlite3_open_v2 (SSDATA (name), &sdb, flags, NULL) != SQLITE_OK)
     return Qnil;
 
-  return make_sqlite (false, sdb, NULL, name);
+  return make_sqlite (false, sdb, NULL, xstrdup (SSDATA (name)));
 }
 
 DEFUN ("sqlite-close", Fsqlite_close, Ssqlite_close, 1, 1, 0,

  reply	other threads:[~2022-04-17 23:21 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-17 21:57 Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration of function 'openat' Keith David Bershatsky
2022-04-17 23:21 ` Paul Eggert [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-26  2:56 Keith David Bershatsky
2022-04-26  3:14 ` Po Lu
2022-04-25  5:17 Keith David Bershatsky
2022-04-25  5:43 ` Po Lu
2022-04-25  9:56   ` Alan Third
2022-04-25 10:30     ` Po Lu
2022-04-25 18:07       ` Alan Third
2022-04-26  0:10         ` Po Lu
2022-04-25  3:46 Keith David Bershatsky
2022-04-25  4:13 ` Po Lu
2022-04-25  1:49 Keith David Bershatsky
2022-04-25  3:09 ` Po Lu
2022-04-25  1:35 Keith David Bershatsky
2022-04-25 18:08 ` Alan Third
2022-04-24 17:02 Keith David Bershatsky
2022-04-24 19:22 ` Alan Third
2022-04-24  0:08 Keith David Bershatsky
2022-04-24  9:03 ` Alan Third
2022-04-23  4:33 Keith David Bershatsky
2022-04-23 22:04 ` Alan Third
2022-04-22 21:29 Keith David Bershatsky
2022-04-23 22:13 ` Alan Third
2022-04-22 21:23 Keith David Bershatsky
2022-04-21 22:40 Keith David Bershatsky
2022-04-21 22:44 ` Alan Third
2022-04-21 20:51 Keith David Bershatsky
2022-04-21 22:22 ` Alan Third
2022-04-21 17:52 Keith David Bershatsky
2022-04-21 19:21 ` Alan Third
2022-04-21  2:22 Keith David Bershatsky
2022-04-21  0:51 Keith David Bershatsky
2022-04-21  2:05 ` Po Lu
2022-04-21  5:09 ` Alan Third
2022-04-20 13:55 Keith David Bershatsky
2022-04-20 16:48 ` Alan Third
2022-04-19  4:36 Keith David Bershatsky
2022-04-19  4:38 ` Po Lu
2022-04-19  1:24 Keith David Bershatsky
2022-04-19  2:35 ` Po Lu
2022-04-19  4:19   ` Alan Third
2022-04-19  4:24     ` Po Lu
2022-04-19  6:04     ` Eli Zaretskii
2022-04-20  1:23     ` Po Lu
2022-04-20  8:07       ` Alan Third
2022-04-19  2:56 ` Paul Eggert
2022-04-18 20:43 Keith David Bershatsky
2022-04-18 19:51 Keith David Bershatsky
2022-04-18 19:54 ` Paul Eggert
2022-04-19  1:00 ` Po Lu
2022-04-18  2:24 Keith David Bershatsky
2022-04-18  2:53 ` Po Lu
2022-04-18  0:38 Keith David Bershatsky
2022-04-18  0:58 ` Paul Eggert
2022-04-18  1:39 ` Po Lu
2022-04-17 18:45 Keith David Bershatsky
2022-04-17 20:37 ` Alan Third
2022-04-17 20:37 ` Paul Eggert
2022-04-15 19:11 Keith David Bershatsky
2022-04-17  9:01 ` Mattias Engdegård
2022-04-17 17:49   ` Paul Eggert
2022-04-17 19:12     ` Eli Zaretskii
2022-04-17 20:36       ` Paul Eggert
2022-04-18  4:49         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a4af68e-a6d3-e0f4-9100-1ca541f17c56@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=athird@googlemail.com \
    --cc=emacs-devel@gnu.org \
    --cc=esq@lawlist.com \
    --cc=mattiase@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).