From: Helmut Eller <eller.helmut@gmail.com>
To: 61165@debbugs.gnu.org
Subject: bug#61165: 30.0.50; Avoid nreverse in row_to_value
Date: Mon, 30 Jan 2023 08:30:14 +0100 [thread overview]
Message-ID: <m2zga0pji1.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 176 bytes --]
The function row_to_value in the file src/sqlite.c can avoid the call to
Fnreverse by traversing the row in reverse order. Only a minor
improvement but the change is simple.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sqlite.patch --]
[-- Type: text/x-diff, Size: 525 bytes --]
diff --git a/src/sqlite.c b/src/sqlite.c
index c96841e63f9..6e89ef04287 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -399,7 +399,7 @@ row_to_value (sqlite3_stmt *stmt)
int len = sqlite3_column_count (stmt);
Lisp_Object values = Qnil;
- for (int i = 0; i < len; ++i)
+ for (int i = len - 1; 0 <= i; i--)
{
Lisp_Object v = Qnil;
@@ -434,7 +434,7 @@ row_to_value (sqlite3_stmt *stmt)
values = Fcons (v, values);
}
- return Fnreverse (values);
+ return values;
}
static Lisp_Object
next reply other threads:[~2023-01-30 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 7:30 Helmut Eller [this message]
2023-02-02 19:49 ` bug#61165: 30.0.50; Avoid nreverse in row_to_value 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2zga0pji1.fsf@gmail.com \
--to=eller.helmut@gmail.com \
--cc=61165@debbugs.gnu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.