emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c5461d0 2/2: Port to platforms where char * has top


From: Paul Eggert
Subject: [Emacs-diffs] master c5461d0 2/2: Port to platforms where char * has top bit set
Date: Tue, 14 Jun 2016 19:21:04 +0000 (UTC)

branch: master
commit c5461d03a411ff5c6f43885a0a9030e8a94bbc2e
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Port to platforms where char * has top bit set
    
    This fixes a five-year-old FIXME comment.  Although I don’t know
    of a platform where this is a problem in practice, better safe
    than sorry.
    * src/doc.c (Fdocumentation): If SUBRP, simply use doc as integer,
    as it is now an integer, not char *.
    (store_function_docstring): Offset is now EMACS_INT, not ptrdiff_t;
    this is a file offset and EMACS_INT is better if --with-wide-int.
    If SUBRP, simply store the offset rather than negating it and
    converting it to char *.
    * src/lisp.h (struct Lisp_Subr.doc): Now EMACS_INT, not char *.
---
 src/doc.c  |   18 +++---------------
 src/lisp.h |    2 +-
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/doc.c b/src/doc.c
index 7107580..6ffdad1 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -339,16 +339,7 @@ string is passed through `substitute-command-keys'.  */)
   if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
     fun = XCDR (fun);
   if (SUBRP (fun))
-    {
-      if (XSUBR (fun)->doc == 0)
-       return Qnil;
-      /* FIXME: This is not portable, as it assumes that string
-        pointers have the top bit clear.  */
-      else if ((intptr_t) XSUBR (fun)->doc >= 0)
-       doc = build_string (XSUBR (fun)->doc);
-      else
-       doc = make_number ((intptr_t) XSUBR (fun)->doc);
-    }
+    doc = make_number (XSUBR (fun)->doc);
   else if (COMPILEDP (fun))
     {
       if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING)
@@ -473,7 +464,7 @@ aren't strings.  */)
 /* Scanning the DOC files and placing docstring offsets into functions.  */
 
 static void
-store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
+store_function_docstring (Lisp_Object obj, EMACS_INT offset)
 {
   /* Don't use indirect_function here, or defaliases will apply their
      docstrings to the base functions (Bug#2603).  */
@@ -502,10 +493,7 @@ store_function_docstring (Lisp_Object obj, ptrdiff_t 
offset)
 
   /* Lisp_Subrs have a slot for it.  */
   else if (SUBRP (fun))
-    {
-      intptr_t negative_offset = - offset;
-      XSUBR (fun)->doc = (char *) negative_offset;
-    }
+    XSUBR (fun)->doc = offset;
 
   /* Bytecode objects sometimes have slots for it.  */
   else if (COMPILEDP (fun))
diff --git a/src/lisp.h b/src/lisp.h
index 972ca33..e0eb52a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1752,7 +1752,7 @@ struct Lisp_Subr
     short min_args, max_args;
     const char *symbol_name;
     const char *intspec;
-    const char *doc;
+    EMACS_INT doc;
   };
 
 enum char_table_specials



reply via email to

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