From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 43439-done@debbugs.gnu.org
Subject: bug#43439: [PATCH] doprnt improvements
Date: Sat, 24 Oct 2020 14:02:25 -0700 [thread overview]
Message-ID: <3ac480a0-bd03-5068-ae9f-ccbe338245d6@cs.ucla.edu> (raw)
In-Reply-To: <83mu0bhpqu.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 93 bytes --]
OK, I installed the patch, followed by the attached minor cleanups. Closing the
bug report.
[-- Attachment #2: 0001-Rename-doprnt_nul-to-doprnt_non_null_end.patch --]
[-- Type: text/x-patch, Size: 1534 bytes --]
From 28d2931b4bc934d06f449c01e067258d76a16738 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 24 Oct 2020 13:46:46 -0700
Subject: [PATCH 1/2] Rename doprnt_nul to doprnt_non_null_end
* src/doprnt.c (doprnt_non_null_end): Rename from doprnt_nul,
as the old name was misleading (left over from a previous proposal).
Caller changed.
---
src/doprnt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/doprnt.c b/src/doprnt.c
index 07c4d8d797..be256f4497 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -150,8 +150,8 @@ parse_format_integer (char const *fmt, int *value)
Emacs version contains doprnt callers that need such formats.
Having a separate function helps GCC optimize doprnt better. */
static ptrdiff_t
-doprnt_nul (char *buffer, ptrdiff_t bufsize, char const *format,
- char const *format_end, va_list ap)
+doprnt_non_null_end (char *buffer, ptrdiff_t bufsize, char const *format,
+ char const *format_end, va_list ap)
{
USE_SAFE_ALLOCA;
ptrdiff_t fmtlen = format_end - format;
@@ -182,7 +182,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
const char *format_end, va_list ap)
{
if (format_end && !memchr (format, 0, format_end - format))
- return doprnt_nul (buffer, bufsize, format, format_end, ap);
+ return doprnt_non_null_end (buffer, bufsize, format, format_end, ap);
const char *fmt = format; /* Pointer into format string. */
char *bufptr = buffer; /* Pointer into output buffer. */
--
2.25.1
[-- Attachment #3: 0002-Minor-doprnt-cleanup-remove-memchr-call.patch --]
[-- Type: text/x-patch, Size: 1640 bytes --]
From 32e427cca112f5471356c1fa95ba1ed256d200b6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 24 Oct 2020 13:50:29 -0700
Subject: [PATCH 2/2] Minor doprnt cleanup: remove memchr call
* src/doprnt.c (doprnt): Remove unnecessary call to memchr.
---
src/doprnt.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/doprnt.c b/src/doprnt.c
index be256f4497..ce259d07cf 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -144,10 +144,10 @@ parse_format_integer (char const *fmt, int *value)
return fmt;
}
-/* Like doprnt, except FORMAT must not contain NUL bytes and
- FORMAT_END must be non-null. Although this function is never
- exercised in current Emacs, it is retained in case some future
- Emacs version contains doprnt callers that need such formats.
+/* Like doprnt, except FORMAT_END must be non-null.
+ Although this function is never exercised in current Emacs,
+ it is retained in case some future Emacs version
+ contains doprnt callers that need such formats.
Having a separate function helps GCC optimize doprnt better. */
static ptrdiff_t
doprnt_non_null_end (char *buffer, ptrdiff_t bufsize, char const *format,
@@ -181,7 +181,7 @@ doprnt_non_null_end (char *buffer, ptrdiff_t bufsize, char const *format,
doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
const char *format_end, va_list ap)
{
- if (format_end && !memchr (format, 0, format_end - format))
+ if (format_end)
return doprnt_non_null_end (buffer, bufsize, format, format_end, ap);
const char *fmt = format; /* Pointer into format string. */
--
2.25.1
prev parent reply other threads:[~2020-10-24 21:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 1:50 bug#43439: [PATCH] doprnt improvements Paul Eggert
2020-09-16 14:58 ` Eli Zaretskii
2020-09-16 22:09 ` Paul Eggert
2020-09-18 7:30 ` Eli Zaretskii
2020-10-15 17:58 ` Paul Eggert
2020-10-15 18:12 ` Eli Zaretskii
2020-10-15 18:50 ` Paul Eggert
2020-10-15 19:05 ` Eli Zaretskii
2020-10-15 20:06 ` Paul Eggert
2020-10-17 18:32 ` Eli Zaretskii
2020-10-18 2:24 ` Paul Eggert
2020-10-24 10:39 ` Eli Zaretskii
2020-10-24 21:02 ` Paul Eggert [this message]
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=3ac480a0-bd03-5068-ae9f-ccbe338245d6@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=43439-done@debbugs.gnu.org \
--cc=eliz@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 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).