emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 d8143fa: Fix module_format_fun_env when dynlib_ad


From: Paul Eggert
Subject: [Emacs-diffs] emacs-25 d8143fa: Fix module_format_fun_env when dynlib_addr fails
Date: Wed, 25 Nov 2015 07:44:14 +0000

branch: emacs-25
commit d8143fa89b60943ac569c02f2a6d4738a217df88
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix module_format_fun_env when dynlib_addr fails
    
    * src/emacs-module.c (module_format_fun_env):
    exprintf doesn’t support %p, so use %x.  Reported by Eli Zaretskii in:
    http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg02122.html
---
 src/emacs-module.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/emacs-module.c b/src/emacs-module.c
index 11aefc3..1388e53 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -1035,15 +1035,15 @@ module_format_fun_env (const struct module_fun_env *env)
 {
   /* Try to print a function name if possible.  */
   const char *path, *sym;
-  char buffer[256];
+  static char const noaddr_format[] = "#<module function at %p>";
+  char buffer[sizeof noaddr_format + INT_STRLEN_BOUND (intptr_t) + 256];
   char *buf = buffer;
   ptrdiff_t bufsize = sizeof buffer;
   ptrdiff_t size
     = (dynlib_addr (env->subr, &path, &sym)
        ? exprintf (&buf, &bufsize, buffer, -1,
                   "#<module function %s from %s>", sym, path)
-       : exprintf (&buf, &bufsize, buffer, -1,
-                  "#<module function at %p>", env->subr));
+       : sprintf (buffer, noaddr_format, env->subr));
   Lisp_Object unibyte_result = make_unibyte_string (buffer, size);
   if (buf != buffer)
     xfree (buf);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]