GNU bug report logs - #61165
30.0.50; Avoid nreverse in row_to_value

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Mon, 30 Jan 2023 07:31:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Helmut Eller <eller.helmut <at> gmail.com>
To: 61165 <at> debbugs.gnu.org
Subject: bug#61165: 30.0.50; Avoid nreverse in row_to_value
Date: Mon, 30 Jan 2023 08:30:14 +0100
[Message part 1 (text/plain, inline)]
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.

[sqlite.patch (text/x-diff, inline)]
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

This bug report was last modified 2 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.