Prefer intptr_t/uintptr_t for integers the same widths as pointers.
[bpt/emacs.git] / src / doc.c
index 3832eb3..740bb26 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -349,10 +349,10 @@ string is passed through `substitute-command-keys'.  */)
        return Qnil;
       /* FIXME: This is not portable, as it assumes that string
         pointers have the top bit clear.  */
-      else if ((EMACS_INT) XSUBR (fun)->doc >= 0)
+      else if ((EMACS_INTPTR) XSUBR (fun)->doc >= 0)
        doc = build_string (XSUBR (fun)->doc);
       else
-       doc = make_number ((EMACS_INT) XSUBR (fun)->doc);
+       doc = make_number ((EMACS_INTPTR) XSUBR (fun)->doc);
     }
   else if (COMPILEDP (fun))
     {
@@ -506,8 +506,11 @@ store_function_docstring (Lisp_Object fun, EMACS_INT offset)
   /* The type determines where the docstring is stored.  */
 
   /* Lisp_Subrs have a slot for it.  */
-  if (SUBRP (fun))
-    XSUBR (fun)->doc = (char *) - offset;
+   if (SUBRP (fun))
+     {
+       EMACS_INTPTR negative_offset = - offset;
+       XSUBR (fun)->doc = (char *) negative_offset;
+     }
 
   /* If it's a lisp form, stick it in the form.  */
   else if (CONSP (fun))