comparison src/editfns.c @ 110480:5290c80fda43

Fix some uses of int instead of EMACS_INT. minibuf.c (Fminibuffer_contents) (Fminibuffer_contents_no_properties) (Fminibuffer_completion_contents): Use EMACS_INT for minibuffer positions. keyboard.c (command_loop_1): Use EMACS_INT to compare point with mark. alloc.c (make_uninit_string, make_uninit_multibyte_string) (allocate_string_data): Accept EMACS_INT for string length. editfns.c (Ffield_string, Ffield_string_no_properties) (make_buffer_string, make_buffer_string_both, Fbuffer_substring) (Fbuffer_substring_no_properties, find_field, Fdelete_field) (Ffield_string, Ffield_string_no_properties, Ffield_beginning) (Ffield_end): Use EMACS_INT for buffer positions. insdel.c (prepare_to_modify_buffer): Use EMACS_INT to compare point with mark. lisp.h (allocate_string_data, make_uninit_string) (make_uninit_multibyte_string, make_buffer_string) (make_buffer_string_both): Adjust prototypes.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 22 Sep 2010 12:03:34 -0400
parents 4d54e23aa31e
children 7ca55779eeef
comparison
equal deleted inserted replaced
110479:437c7aaf08fd 110480:5290c80fda43
92 #ifdef WINDOWSNT 92 #ifdef WINDOWSNT
93 extern Lisp_Object w32_get_internal_run_time (void); 93 extern Lisp_Object w32_get_internal_run_time (void);
94 #endif 94 #endif
95 95
96 static int tm_diff (struct tm *, struct tm *); 96 static int tm_diff (struct tm *, struct tm *);
97 static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *); 97 static void find_field (Lisp_Object, Lisp_Object, Lisp_Object,
98 EMACS_INT *, Lisp_Object, EMACS_INT *);
98 static void update_buffer_properties (int, int); 99 static void update_buffer_properties (int, int);
99 static Lisp_Object region_limit (int); 100 static Lisp_Object region_limit (int);
100 static size_t emacs_memftimeu (char *, size_t, const char *, 101 static size_t emacs_memftimeu (char *, size_t, const char *,
101 size_t, const struct tm *, int); 102 size_t, const struct tm *, int);
102 static void general_insert_function (void (*) (const unsigned char *, EMACS_INT), 103 static void general_insert_function (void (*) (const unsigned char *, EMACS_INT),
513 514
514 Either BEG or END may be 0, in which case the corresponding value 515 Either BEG or END may be 0, in which case the corresponding value
515 is not stored. */ 516 is not stored. */
516 517
517 static void 518 static void
518 find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, Lisp_Object beg_limit, int *beg, Lisp_Object end_limit, int *end) 519 find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
520 Lisp_Object beg_limit,
521 EMACS_INT *beg, Lisp_Object end_limit, EMACS_INT *end)
519 { 522 {
520 /* Fields right before and after the point. */ 523 /* Fields right before and after the point. */
521 Lisp_Object before_field, after_field; 524 Lisp_Object before_field, after_field;
522 /* 1 if POS counts as the start of a field. */ 525 /* 1 if POS counts as the start of a field. */
523 int at_field_start = 0; 526 int at_field_start = 0;
629 doc: /* Delete the field surrounding POS. 632 doc: /* Delete the field surrounding POS.
630 A field is a region of text with the same `field' property. 633 A field is a region of text with the same `field' property.
631 If POS is nil, the value of point is used for POS. */) 634 If POS is nil, the value of point is used for POS. */)
632 (Lisp_Object pos) 635 (Lisp_Object pos)
633 { 636 {
634 int beg, end; 637 EMACS_INT beg, end;
635 find_field (pos, Qnil, Qnil, &beg, Qnil, &end); 638 find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
636 if (beg != end) 639 if (beg != end)
637 del_range (beg, end); 640 del_range (beg, end);
638 return Qnil; 641 return Qnil;
639 } 642 }
642 doc: /* Return the contents of the field surrounding POS as a string. 645 doc: /* Return the contents of the field surrounding POS as a string.
643 A field is a region of text with the same `field' property. 646 A field is a region of text with the same `field' property.
644 If POS is nil, the value of point is used for POS. */) 647 If POS is nil, the value of point is used for POS. */)
645 (Lisp_Object pos) 648 (Lisp_Object pos)
646 { 649 {
647 int beg, end; 650 EMACS_INT beg, end;
648 find_field (pos, Qnil, Qnil, &beg, Qnil, &end); 651 find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
649 return make_buffer_string (beg, end, 1); 652 return make_buffer_string (beg, end, 1);
650 } 653 }
651 654
652 DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0, 655 DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0,
653 doc: /* Return the contents of the field around POS, without text properties. 656 doc: /* Return the contents of the field around POS, without text properties.
654 A field is a region of text with the same `field' property. 657 A field is a region of text with the same `field' property.
655 If POS is nil, the value of point is used for POS. */) 658 If POS is nil, the value of point is used for POS. */)
656 (Lisp_Object pos) 659 (Lisp_Object pos)
657 { 660 {
658 int beg, end; 661 EMACS_INT beg, end;
659 find_field (pos, Qnil, Qnil, &beg, Qnil, &end); 662 find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
660 return make_buffer_string (beg, end, 0); 663 return make_buffer_string (beg, end, 0);
661 } 664 }
662 665
663 DEFUN ("field-beginning", Ffield_beginning, Sfield_beginning, 0, 3, 0, 666 DEFUN ("field-beginning", Ffield_beginning, Sfield_beginning, 0, 3, 0,
668 field, then the beginning of the *previous* field is returned. 671 field, then the beginning of the *previous* field is returned.
669 If LIMIT is non-nil, it is a buffer position; if the beginning of the field 672 If LIMIT is non-nil, it is a buffer position; if the beginning of the field
670 is before LIMIT, then LIMIT will be returned instead. */) 673 is before LIMIT, then LIMIT will be returned instead. */)
671 (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) 674 (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit)
672 { 675 {
673 int beg; 676 EMACS_INT beg;
674 find_field (pos, escape_from_edge, limit, &beg, Qnil, 0); 677 find_field (pos, escape_from_edge, limit, &beg, Qnil, 0);
675 return make_number (beg); 678 return make_number (beg);
676 } 679 }
677 680
678 DEFUN ("field-end", Ffield_end, Sfield_end, 0, 3, 0, 681 DEFUN ("field-end", Ffield_end, Sfield_end, 0, 3, 0,
683 then the end of the *following* field is returned. 686 then the end of the *following* field is returned.
684 If LIMIT is non-nil, it is a buffer position; if the end of the field 687 If LIMIT is non-nil, it is a buffer position; if the end of the field
685 is after LIMIT, then LIMIT will be returned instead. */) 688 is after LIMIT, then LIMIT will be returned instead. */)
686 (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) 689 (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit)
687 { 690 {
688 int end; 691 EMACS_INT end;
689 find_field (pos, escape_from_edge, Qnil, 0, limit, &end); 692 find_field (pos, escape_from_edge, Qnil, 0, limit, &end);
690 return make_number (end); 693 return make_number (end);
691 } 694 }
692 695
693 DEFUN ("constrain-to-field", Fconstrain_to_field, Sconstrain_to_field, 2, 5, 0, 696 DEFUN ("constrain-to-field", Fconstrain_to_field, Sconstrain_to_field, 2, 5, 0,
2341 doesn't effect most of the other users of make_string, so it should 2344 doesn't effect most of the other users of make_string, so it should
2342 be left as is. But we should use this function when conjuring 2345 be left as is. But we should use this function when conjuring
2343 buffer substrings. */ 2346 buffer substrings. */
2344 2347
2345 Lisp_Object 2348 Lisp_Object
2346 make_buffer_string (int start, int end, int props) 2349 make_buffer_string (EMACS_INT start, EMACS_INT end, int props)
2347 { 2350 {
2348 int start_byte = CHAR_TO_BYTE (start); 2351 EMACS_INT start_byte = CHAR_TO_BYTE (start);
2349 int end_byte = CHAR_TO_BYTE (end); 2352 EMACS_INT end_byte = CHAR_TO_BYTE (end);
2350 2353
2351 return make_buffer_string_both (start, start_byte, end, end_byte, props); 2354 return make_buffer_string_both (start, start_byte, end, end_byte, props);
2352 } 2355 }
2353 2356
2354 /* Return a Lisp_String containing the text of the current buffer from 2357 /* Return a Lisp_String containing the text of the current buffer from
2365 doesn't effect most of the other users of make_string, so it should 2368 doesn't effect most of the other users of make_string, so it should
2366 be left as is. But we should use this function when conjuring 2369 be left as is. But we should use this function when conjuring
2367 buffer substrings. */ 2370 buffer substrings. */
2368 2371
2369 Lisp_Object 2372 Lisp_Object
2370 make_buffer_string_both (int start, int start_byte, int end, int end_byte, int props) 2373 make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte,
2374 EMACS_INT end, EMACS_INT end_byte, int props)
2371 { 2375 {
2372 Lisp_Object result, tem, tem1; 2376 Lisp_Object result, tem, tem1;
2373 2377
2374 if (start < GPT && GPT < end) 2378 if (start < GPT && GPT < end)
2375 move_gap (start); 2379 move_gap (start);
2437 This function copies the text properties of that part of the buffer 2441 This function copies the text properties of that part of the buffer
2438 into the result string; if you don't want the text properties, 2442 into the result string; if you don't want the text properties,
2439 use `buffer-substring-no-properties' instead. */) 2443 use `buffer-substring-no-properties' instead. */)
2440 (Lisp_Object start, Lisp_Object end) 2444 (Lisp_Object start, Lisp_Object end)
2441 { 2445 {
2442 register int b, e; 2446 register EMACS_INT b, e;
2443 2447
2444 validate_region (&start, &end); 2448 validate_region (&start, &end);
2445 b = XINT (start); 2449 b = XINT (start);
2446 e = XINT (end); 2450 e = XINT (end);
2447 2451
2453 doc: /* Return the characters of part of the buffer, without the text properties. 2457 doc: /* Return the characters of part of the buffer, without the text properties.
2454 The two arguments START and END are character positions; 2458 The two arguments START and END are character positions;
2455 they can be in either order. */) 2459 they can be in either order. */)
2456 (Lisp_Object start, Lisp_Object end) 2460 (Lisp_Object start, Lisp_Object end)
2457 { 2461 {
2458 register int b, e; 2462 register EMACS_INT b, e;
2459 2463
2460 validate_region (&start, &end); 2464 validate_region (&start, &end);
2461 b = XINT (start); 2465 b = XINT (start);
2462 e = XINT (end); 2466 e = XINT (end);
2463 2467