aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.c
diff options
context:
space:
mode:
authorJoakim Verona2011-08-27 19:45:48 +0200
committerJoakim Verona2011-08-27 19:45:48 +0200
commit9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4 (patch)
treee94476d49f15747fcb9409d773702e88201855a4 /src/doc.c
parentc7489583c30031c0ecfae9d20b20c149ca1935e9 (diff)
parentb75258b32810f3690442bddef2e10eef126d2d25 (diff)
downloademacs-9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4.tar.gz
emacs-9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4.zip
upstream
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/doc.c b/src/doc.c
index 69646f5af51..83e943c42b8 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -39,7 +39,7 @@ Lisp_Object Qfunction_documentation;
39extern Lisp_Object Qclosure; 39extern Lisp_Object Qclosure;
40/* Buffer used for reading from documentation file. */ 40/* Buffer used for reading from documentation file. */
41static char *get_doc_string_buffer; 41static char *get_doc_string_buffer;
42static int get_doc_string_buffer_size; 42static ptrdiff_t get_doc_string_buffer_size;
43 43
44static unsigned char *read_bytecode_pointer; 44static unsigned char *read_bytecode_pointer;
45static Lisp_Object Fdocumentation_property (Lisp_Object, Lisp_Object, 45static Lisp_Object Fdocumentation_property (Lisp_Object, Lisp_Object,
@@ -166,20 +166,19 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
166 p = get_doc_string_buffer; 166 p = get_doc_string_buffer;
167 while (1) 167 while (1)
168 { 168 {
169 EMACS_INT space_left = (get_doc_string_buffer_size 169 ptrdiff_t space_left = (get_doc_string_buffer_size - 1
170 - (p - get_doc_string_buffer)); 170 - (p - get_doc_string_buffer));
171 int nread; 171 int nread;
172 172
173 /* Allocate or grow the buffer if we need to. */ 173 /* Allocate or grow the buffer if we need to. */
174 if (space_left == 0) 174 if (space_left <= 0)
175 { 175 {
176 EMACS_INT in_buffer = p - get_doc_string_buffer; 176 ptrdiff_t in_buffer = p - get_doc_string_buffer;
177 get_doc_string_buffer_size += 16 * 1024; 177 get_doc_string_buffer =
178 get_doc_string_buffer 178 xpalloc (get_doc_string_buffer, &get_doc_string_buffer_size,
179 = (char *) xrealloc (get_doc_string_buffer, 179 16 * 1024, -1, 1);
180 get_doc_string_buffer_size + 1);
181 p = get_doc_string_buffer + in_buffer; 180 p = get_doc_string_buffer + in_buffer;
182 space_left = (get_doc_string_buffer_size 181 space_left = (get_doc_string_buffer_size - 1
183 - (p - get_doc_string_buffer)); 182 - (p - get_doc_string_buffer));
184 } 183 }
185 184
@@ -713,16 +712,16 @@ a new string, without any text properties, is returned. */)
713 int changed = 0; 712 int changed = 0;
714 register unsigned char *strp; 713 register unsigned char *strp;
715 register char *bufp; 714 register char *bufp;
716 EMACS_INT idx; 715 ptrdiff_t idx;
717 EMACS_INT bsize; 716 ptrdiff_t bsize;
718 Lisp_Object tem; 717 Lisp_Object tem;
719 Lisp_Object keymap; 718 Lisp_Object keymap;
720 unsigned char *start; 719 unsigned char *start;
721 EMACS_INT length, length_byte; 720 ptrdiff_t length, length_byte;
722 Lisp_Object name; 721 Lisp_Object name;
723 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 722 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
724 int multibyte; 723 int multibyte;
725 EMACS_INT nchars; 724 ptrdiff_t nchars;
726 725
727 if (NILP (string)) 726 if (NILP (string))
728 return Qnil; 727 return Qnil;
@@ -774,7 +773,7 @@ a new string, without any text properties, is returned. */)
774 } 773 }
775 else if (strp[0] == '\\' && strp[1] == '[') 774 else if (strp[0] == '\\' && strp[1] == '[')
776 { 775 {
777 EMACS_INT start_idx; 776 ptrdiff_t start_idx;
778 int follow_remap = 1; 777 int follow_remap = 1;
779 778
780 changed = 1; 779 changed = 1;
@@ -813,7 +812,9 @@ a new string, without any text properties, is returned. */)
813 812
814 if (NILP (tem)) /* but not on any keys */ 813 if (NILP (tem)) /* but not on any keys */
815 { 814 {
816 EMACS_INT offset = bufp - buf; 815 ptrdiff_t offset = bufp - buf;
816 if (STRING_BYTES_BOUND - 4 < bsize)
817 string_overflow ();
817 buf = (char *) xrealloc (buf, bsize += 4); 818 buf = (char *) xrealloc (buf, bsize += 4);
818 bufp = buf + offset; 819 bufp = buf + offset;
819 memcpy (bufp, "M-x ", 4); 820 memcpy (bufp, "M-x ", 4);
@@ -836,7 +837,7 @@ a new string, without any text properties, is returned. */)
836 else if (strp[0] == '\\' && (strp[1] == '{' || strp[1] == '<')) 837 else if (strp[0] == '\\' && (strp[1] == '{' || strp[1] == '<'))
837 { 838 {
838 struct buffer *oldbuf; 839 struct buffer *oldbuf;
839 EMACS_INT start_idx; 840 ptrdiff_t start_idx;
840 /* This is for computing the SHADOWS arg for describe_map_tree. */ 841 /* This is for computing the SHADOWS arg for describe_map_tree. */
841 Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); 842 Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil);
842 Lisp_Object earlier_maps; 843 Lisp_Object earlier_maps;
@@ -907,7 +908,9 @@ a new string, without any text properties, is returned. */)
907 length_byte = SBYTES (tem); 908 length_byte = SBYTES (tem);
908 subst: 909 subst:
909 { 910 {
910 EMACS_INT offset = bufp - buf; 911 ptrdiff_t offset = bufp - buf;
912 if (STRING_BYTES_BOUND - length_byte < bsize)
913 string_overflow ();
911 buf = (char *) xrealloc (buf, bsize += length_byte); 914 buf = (char *) xrealloc (buf, bsize += length_byte);
912 bufp = buf + offset; 915 bufp = buf + offset;
913 memcpy (bufp, start, length_byte); 916 memcpy (bufp, start, length_byte);