aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorKenichi Handa2012-07-17 07:09:08 +0900
committerKenichi Handa2012-07-17 07:09:08 +0900
commit8c536f15bf95916d56bb50495d22b7da7e09fff9 (patch)
treeac6f8bf5103bdbd1d6a75f05def9bc7aa9e96547 /src/data.c
parent21a8caaa4af24f258e6c7f80c1fc913b00aee044 (diff)
parentc05cf3902ae658cc8bf413124245c9e1cdcca2d7 (diff)
downloademacs-8c536f15bf95916d56bb50495d22b7da7e09fff9.tar.gz
emacs-8c536f15bf95916d56bb50495d22b7da7e09fff9.zip
merge trunk
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/data.c b/src/data.c
index feacea2c08b..defcd06a2ed 100644
--- a/src/data.c
+++ b/src/data.c
@@ -34,6 +34,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34#include "syssignal.h" 34#include "syssignal.h"
35#include "termhooks.h" /* For FRAME_KBOARD reference in y-or-n-p. */ 35#include "termhooks.h" /* For FRAME_KBOARD reference in y-or-n-p. */
36#include "font.h" 36#include "font.h"
37#include "keymap.h"
37 38
38#include <float.h> 39#include <float.h>
39/* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ 40/* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */
@@ -92,6 +93,7 @@ Lisp_Object Qbuffer;
92static Lisp_Object Qchar_table, Qbool_vector, Qhash_table; 93static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
93static Lisp_Object Qsubrp, Qmany, Qunevalled; 94static Lisp_Object Qsubrp, Qmany, Qunevalled;
94Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; 95Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
96static Lisp_Object Qdefun;
95 97
96Lisp_Object Qinteractive_form; 98Lisp_Object Qinteractive_form;
97 99
@@ -130,7 +132,7 @@ args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3)
130} 132}
131 133
132 134
133/* Data type predicates */ 135/* Data type predicates. */
134 136
135DEFUN ("eq", Feq, Seq, 2, 2, 0, 137DEFUN ("eq", Feq, Seq, 2, 2, 0,
136 doc: /* Return t if the two args are the same Lisp object. */) 138 doc: /* Return t if the two args are the same Lisp object. */)
@@ -656,6 +658,10 @@ determined by DEFINITION. */)
656 if (CONSP (XSYMBOL (symbol)->function) 658 if (CONSP (XSYMBOL (symbol)->function)
657 && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) 659 && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload))
658 LOADHIST_ATTACH (Fcons (Qt, symbol)); 660 LOADHIST_ATTACH (Fcons (Qt, symbol));
661 if (!NILP (Vpurify_flag)
662 /* If `definition' is a keymap, immutable (and copying) is wrong. */
663 && !KEYMAPP (definition))
664 definition = Fpurecopy (definition);
659 definition = Ffset (symbol, definition); 665 definition = Ffset (symbol, definition);
660 LOADHIST_ATTACH (Fcons (Qdefun, symbol)); 666 LOADHIST_ATTACH (Fcons (Qdefun, symbol));
661 if (!NILP (docstring)) 667 if (!NILP (docstring))
@@ -1075,18 +1081,18 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
1075{ 1081{
1076 struct specbinding *p; 1082 struct specbinding *p;
1077 1083
1078 for (p = specpdl_ptr - 1; p >= specpdl; p--) 1084 for (p = specpdl_ptr; p > specpdl; )
1079 if (p->func == NULL 1085 if ((--p)->func == NULL
1080 && CONSP (p->symbol)) 1086 && CONSP (p->symbol))
1081 { 1087 {
1082 struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); 1088 struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol));
1083 eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS); 1089 eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS);
1084 if (symbol == let_bound_symbol 1090 if (symbol == let_bound_symbol
1085 && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) 1091 && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer)
1086 break; 1092 return 1;
1087 } 1093 }
1088 1094
1089 return p >= specpdl; 1095 return 0;
1090} 1096}
1091 1097
1092static int 1098static int
@@ -1094,11 +1100,11 @@ let_shadows_global_binding_p (Lisp_Object symbol)
1094{ 1100{
1095 struct specbinding *p; 1101 struct specbinding *p;
1096 1102
1097 for (p = specpdl_ptr - 1; p >= specpdl; p--) 1103 for (p = specpdl_ptr; p > specpdl; )
1098 if (p->func == NULL && EQ (p->symbol, symbol)) 1104 if ((--p)->func == NULL && EQ (p->symbol, symbol))
1099 break; 1105 return 1;
1100 1106
1101 return p >= specpdl; 1107 return 0;
1102} 1108}
1103 1109
1104/* Store the value NEWVAL into SYMBOL. 1110/* Store the value NEWVAL into SYMBOL.
@@ -2064,7 +2070,7 @@ or a byte-code object. IDX starts at 0. */)
2064 if (STRINGP (array)) 2070 if (STRINGP (array))
2065 { 2071 {
2066 int c; 2072 int c;
2067 EMACS_INT idxval_byte; 2073 ptrdiff_t idxval_byte;
2068 2074
2069 if (idxval < 0 || idxval >= SCHARS (array)) 2075 if (idxval < 0 || idxval >= SCHARS (array))
2070 args_out_of_range (array, idx); 2076 args_out_of_range (array, idx);
@@ -2092,7 +2098,7 @@ or a byte-code object. IDX starts at 0. */)
2092 } 2098 }
2093 else 2099 else
2094 { 2100 {
2095 int size = 0; 2101 ptrdiff_t size = 0;
2096 if (VECTORP (array)) 2102 if (VECTORP (array))
2097 size = ASIZE (array); 2103 size = ASIZE (array);
2098 else if (COMPILEDP (array)) 2104 else if (COMPILEDP (array))
@@ -2156,7 +2162,8 @@ bool-vector. IDX starts at 0. */)
2156 2162
2157 if (STRING_MULTIBYTE (array)) 2163 if (STRING_MULTIBYTE (array))
2158 { 2164 {
2159 EMACS_INT idxval_byte, prev_bytes, new_bytes, nbytes; 2165 ptrdiff_t idxval_byte, nbytes;
2166 int prev_bytes, new_bytes;
2160 unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; 2167 unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
2161 2168
2162 nbytes = SBYTES (array); 2169 nbytes = SBYTES (array);
@@ -2167,7 +2174,7 @@ bool-vector. IDX starts at 0. */)
2167 if (prev_bytes != new_bytes) 2174 if (prev_bytes != new_bytes)
2168 { 2175 {
2169 /* We must relocate the string data. */ 2176 /* We must relocate the string data. */
2170 EMACS_INT nchars = SCHARS (array); 2177 ptrdiff_t nchars = SCHARS (array);
2171 unsigned char *str; 2178 unsigned char *str;
2172 USE_SAFE_ALLOCA; 2179 USE_SAFE_ALLOCA;
2173 2180
@@ -2474,9 +2481,9 @@ If the base used is not 10, STRING is always parsed as integer. */)
2474 else 2481 else
2475 { 2482 {
2476 CHECK_NUMBER (base); 2483 CHECK_NUMBER (base);
2477 b = XINT (base); 2484 if (! (2 <= XINT (base) && XINT (base) <= 16))
2478 if (b < 2 || b > 16)
2479 xsignal1 (Qargs_out_of_range, base); 2485 xsignal1 (Qargs_out_of_range, base);
2486 b = XINT (base);
2480 } 2487 }
2481 2488
2482 p = SSDATA (string); 2489 p = SSDATA (string);
@@ -2724,7 +2731,7 @@ Both must be integers or markers. */)
2724 CHECK_NUMBER_COERCE_MARKER (x); 2731 CHECK_NUMBER_COERCE_MARKER (x);
2725 CHECK_NUMBER_COERCE_MARKER (y); 2732 CHECK_NUMBER_COERCE_MARKER (y);
2726 2733
2727 if (XFASTINT (y) == 0) 2734 if (XINT (y) == 0)
2728 xsignal0 (Qarith_error); 2735 xsignal0 (Qarith_error);
2729 2736
2730 XSETINT (val, XINT (x) % XINT (y)); 2737 XSETINT (val, XINT (x) % XINT (y));
@@ -3084,6 +3091,8 @@ syms_of_data (void)
3084 DEFSYM (Qbool_vector, "bool-vector"); 3091 DEFSYM (Qbool_vector, "bool-vector");
3085 DEFSYM (Qhash_table, "hash-table"); 3092 DEFSYM (Qhash_table, "hash-table");
3086 3093
3094 DEFSYM (Qdefun, "defun");
3095
3087 DEFSYM (Qfont_spec, "font-spec"); 3096 DEFSYM (Qfont_spec, "font-spec");
3088 DEFSYM (Qfont_entity, "font-entity"); 3097 DEFSYM (Qfont_entity, "font-entity");
3089 DEFSYM (Qfont_object, "font-object"); 3098 DEFSYM (Qfont_object, "font-object");