X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/7be1c708c5abc7dea388d45454bd19bff07b7943..d311d28c3f8a3c43e6ef33d68b852c5ea7f13239:/src/editfns.c diff --git a/src/editfns.c b/src/editfns.c index 297f7b6d7e..ac9c20ced6 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -86,7 +86,7 @@ extern Lisp_Object w32_get_internal_run_time (void); static void time_overflow (void) NO_RETURN; static int tm_diff (struct tm *, struct tm *); -static void update_buffer_properties (EMACS_INT, EMACS_INT); +static void update_buffer_properties (ptrdiff_t, ptrdiff_t); static Lisp_Object Qbuffer_access_fontify_functions; static Lisp_Object Fuser_full_name (Lisp_Object); @@ -146,8 +146,14 @@ init_editfns (void) /* If the user name claimed in the environment vars differs from the real uid, use the claimed name to find the full name. */ tem = Fstring_equal (Vuser_login_name, Vuser_real_login_name); - Vuser_full_name = Fuser_full_name (NILP (tem)? make_number (geteuid()) - : Vuser_login_name); + if (! NILP (tem)) + tem = Vuser_login_name; + else + { + uid_t euid = geteuid (); + tem = make_fixnum_or_float (euid); + } + Vuser_full_name = Fuser_full_name (tem); p = getenv ("NAME"); if (p) @@ -212,7 +218,7 @@ DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, } static Lisp_Object -buildmark (EMACS_INT charpos, EMACS_INT bytepos) +buildmark (ptrdiff_t charpos, ptrdiff_t bytepos) { register Lisp_Object mark; mark = Fmake_marker (); @@ -237,17 +243,6 @@ DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0, return buildmark (PT, PT_BYTE); } -EMACS_INT -clip_to_bounds (EMACS_INT lower, EMACS_INT num, EMACS_INT upper) -{ - if (num < lower) - return lower; - else if (num > upper) - return upper; - else - return num; -} - DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", doc: /* Set point to POSITION, a number or marker. Beginning of buffer is position (point-min), end is (point-max). @@ -255,7 +250,7 @@ Beginning of buffer is position (point-min), end is (point-max). The return value is POSITION. */) (register Lisp_Object position) { - EMACS_INT pos; + ptrdiff_t pos; if (MARKERP (position) && current_buffer == XMARKER (position)->buffer) @@ -335,7 +330,7 @@ overlays_around (EMACS_INT pos, Lisp_Object *vec, ptrdiff_t len) { Lisp_Object overlay, start, end; struct Lisp_Overlay *tail; - EMACS_INT startpos, endpos; + ptrdiff_t startpos, endpos; ptrdiff_t idx = 0; for (tail = current_buffer->overlays_before; tail; tail = tail->next) @@ -484,7 +479,7 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o static void find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, Lisp_Object beg_limit, - EMACS_INT *beg, Lisp_Object end_limit, EMACS_INT *end) + ptrdiff_t *beg, Lisp_Object end_limit, ptrdiff_t *end) { /* Fields right before and after the point. */ Lisp_Object before_field, after_field; @@ -600,7 +595,7 @@ A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) (Lisp_Object pos) { - EMACS_INT beg, end; + ptrdiff_t beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); if (beg != end) del_range (beg, end); @@ -613,7 +608,7 @@ A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) (Lisp_Object pos) { - EMACS_INT beg, end; + ptrdiff_t beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); return make_buffer_string (beg, end, 1); } @@ -624,7 +619,7 @@ A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) (Lisp_Object pos) { - EMACS_INT beg, end; + ptrdiff_t beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); return make_buffer_string (beg, end, 0); } @@ -639,7 +634,7 @@ If LIMIT is non-nil, it is a buffer position; if the beginning of the field is before LIMIT, then LIMIT will be returned instead. */) (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) { - EMACS_INT beg; + ptrdiff_t beg; find_field (pos, escape_from_edge, limit, &beg, Qnil, 0); return make_number (beg); } @@ -654,7 +649,7 @@ If LIMIT is non-nil, it is a buffer position; if the end of the field is after LIMIT, then LIMIT will be returned instead. */) (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) { - EMACS_INT end; + ptrdiff_t end; find_field (pos, escape_from_edge, Qnil, 0, limit, &end); return make_number (end); } @@ -689,7 +684,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property) { /* If non-zero, then the original point, before re-positioning. */ - EMACS_INT orig_point = 0; + ptrdiff_t orig_point = 0; int fwd; Lisp_Object prev_old, prev_new; @@ -703,10 +698,10 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) CHECK_NUMBER_COERCE_MARKER (new_pos); CHECK_NUMBER_COERCE_MARKER (old_pos); - fwd = (XFASTINT (new_pos) > XFASTINT (old_pos)); + fwd = (XINT (new_pos) > XINT (old_pos)); - prev_old = make_number (XFASTINT (old_pos) - 1); - prev_new = make_number (XFASTINT (new_pos) - 1); + prev_old = make_number (XINT (old_pos) - 1); + prev_new = make_number (XINT (new_pos) - 1); if (NILP (Vinhibit_field_text_motion) && !EQ (new_pos, old_pos) @@ -731,7 +726,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) /* It is possible that NEW_POS is not within the same field as OLD_POS; try to move NEW_POS so that it is. */ { - EMACS_INT shortage; + ptrdiff_t shortage; Lisp_Object field_bound; if (fwd) @@ -786,8 +781,8 @@ boundaries bind `inhibit-field-text-motion' to t. This function does not move point. */) (Lisp_Object n) { - EMACS_INT orig, orig_byte, end; - int count = SPECPDL_INDEX (); + ptrdiff_t orig, orig_byte, end; + ptrdiff_t count = SPECPDL_INDEX (); specbind (Qinhibit_point_motion_hooks, Qt); if (NILP (n)) @@ -827,15 +822,17 @@ boundaries bind `inhibit-field-text-motion' to t. This function does not move point. */) (Lisp_Object n) { - EMACS_INT end_pos; - EMACS_INT orig = PT; + ptrdiff_t clipped_n; + ptrdiff_t end_pos; + ptrdiff_t orig = PT; if (NILP (n)) XSETFASTINT (n, 1); else CHECK_NUMBER (n); - end_pos = find_before_next_newline (orig, 0, XINT (n) - (XINT (n) <= 0)); + clipped_n = clip_to_bounds (PTRDIFF_MIN + 1, XINT (n), PTRDIFF_MAX); + end_pos = find_before_next_newline (orig, 0, clipped_n - (clipped_n <= 0)); /* Return END_POS constrained to the current input field. */ return Fconstrain_to_field (make_number (end_pos), make_number (orig), @@ -962,7 +959,7 @@ usage: (save-excursion &rest BODY) */) (Lisp_Object args) { register Lisp_Object val; - int count = SPECPDL_INDEX (); + ptrdiff_t count = SPECPDL_INDEX (); record_unwind_protect (save_excursion_restore, save_excursion_save ()); @@ -977,7 +974,7 @@ usage: (save-current-buffer &rest BODY) */) (Lisp_Object args) { Lisp_Object val; - int count = SPECPDL_INDEX (); + ptrdiff_t count = SPECPDL_INDEX (); record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); @@ -1103,7 +1100,7 @@ At the beginning of the buffer or accessible region, return 0. */) XSETFASTINT (temp, 0); else if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) { - EMACS_INT pos = PT_BYTE; + ptrdiff_t pos = PT_BYTE; DEC_POS (pos); XSETFASTINT (temp, FETCH_CHAR (pos)); } @@ -1157,7 +1154,7 @@ POS is an integer or a marker and defaults to point. If POS is out of range, the value is nil. */) (Lisp_Object pos) { - register EMACS_INT pos_byte; + register ptrdiff_t pos_byte; if (NILP (pos)) { @@ -1190,7 +1187,7 @@ If POS is out of range, the value is nil. */) (Lisp_Object pos) { register Lisp_Object val; - register EMACS_INT pos_byte; + register ptrdiff_t pos_byte; if (NILP (pos)) { @@ -1277,14 +1274,7 @@ DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0, Value is an integer or a float, depending on the value. */) (void) { - /* Assignment to EMACS_INT stops GCC whining about limited range of - data type. */ - EMACS_INT euid = geteuid (); - - /* Make sure we don't produce a negative UID due to signed integer - overflow. */ - if (euid < 0) - return make_float (geteuid ()); + uid_t euid = geteuid (); return make_fixnum_or_float (euid); } @@ -1293,14 +1283,7 @@ DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0, Value is an integer or a float, depending on the value. */) (void) { - /* Assignment to EMACS_INT stops GCC whining about limited range of - data type. */ - EMACS_INT uid = getuid (); - - /* Make sure we don't produce a negative UID due to signed integer - overflow. */ - if (uid < 0) - return make_float (getuid ()); + uid_t uid = getuid (); return make_fixnum_or_float (uid); } @@ -1385,10 +1368,11 @@ get_system_name (void) } DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, - doc: /* Return the process ID of Emacs, as an integer. */) + doc: /* Return the process ID of Emacs, as a number. */) (void) { - return make_number (getpid ()); + pid_t pid = getpid (); + return make_fixnum_or_float (pid); } @@ -1428,7 +1412,7 @@ hi_time (time_t t) } /* Return the bottom 16 bits of the time T. */ -static EMACS_INT +static int lo_time (time_t t) { return t & ((1 << 16) - 1); @@ -1546,6 +1530,8 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) else { CHECK_NUMBER (usec_l); + if (! (0 <= XINT (usec_l) && XINT (usec_l) < 1000000)) + return 0; *usec = XINT (usec_l); } } @@ -1883,9 +1869,12 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) tzstring = SSDATA (zone); else if (INTEGERP (zone)) { - int abszone = eabs (XINT (zone)); - sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0), - abszone / (60*60), (abszone/60) % 60, abszone % 60); + EMACS_INT abszone = eabs (XINT (zone)); + EMACS_INT zone_hr = abszone / (60*60); + int zone_min = (abszone/60) % 60; + int zone_sec = abszone % 60; + sprintf (tzbuf, "XXX%s%"pI"d:%02d:%02d", "-" + (XINT (zone) < 0), + zone_hr, zone_min, zone_sec); tzstring = tzbuf; } else @@ -2014,7 +2003,7 @@ the data it can't find. */) { int offset = tm_diff (t, &gmt); char *s = 0; - char buf[6]; + char buf[sizeof "+00" + INT_STRLEN_BOUND (int)]; #ifdef HAVE_TM_ZONE if (t->tm_zone) @@ -2029,7 +2018,8 @@ the data it can't find. */) if (!s) { /* No local time zone name is available; use "+-NNNN" instead. */ - int am = (offset < 0 ? -offset : offset) / 60; + int m = offset / 60; + int am = offset < 0 ? - m : m; sprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60); s = buf; } @@ -2107,7 +2097,7 @@ static char set_time_zone_rule_tz2[] = "TZ=GMT+1"; void set_time_zone_rule (const char *tzstring) { - int envptrs; + ptrdiff_t envptrs; char **from, **to, **newenv; /* Make the ENVIRON vector longer with room for TZSTRING. */ @@ -2186,10 +2176,10 @@ set_time_zone_rule (const char *tzstring) static void general_insert_function (void (*insert_func) - (const char *, EMACS_INT), + (const char *, ptrdiff_t), void (*insert_from_string_func) - (Lisp_Object, EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT, int), + (Lisp_Object, ptrdiff_t, ptrdiff_t, + ptrdiff_t, ptrdiff_t, int), int inherit, ptrdiff_t nargs, Lisp_Object *args) { ptrdiff_t argnum; @@ -2325,7 +2315,7 @@ from adjoining text, if those properties are sticky. */) (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) { int i, stringlen; - register EMACS_INT n; + register ptrdiff_t n; int c, len; unsigned char str[MAX_MULTIBYTE_LENGTH]; char string[4000]; @@ -2401,10 +2391,10 @@ from adjoining text, if those properties are sticky. */) buffer substrings. */ Lisp_Object -make_buffer_string (EMACS_INT start, EMACS_INT end, int props) +make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props) { - EMACS_INT start_byte = CHAR_TO_BYTE (start); - EMACS_INT end_byte = CHAR_TO_BYTE (end); + ptrdiff_t start_byte = CHAR_TO_BYTE (start); + ptrdiff_t end_byte = CHAR_TO_BYTE (end); return make_buffer_string_both (start, start_byte, end, end_byte, props); } @@ -2425,8 +2415,8 @@ make_buffer_string (EMACS_INT start, EMACS_INT end, int props) buffer substrings. */ Lisp_Object -make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte, - EMACS_INT end, EMACS_INT end_byte, int props) +make_buffer_string_both (ptrdiff_t start, ptrdiff_t start_byte, + ptrdiff_t end, ptrdiff_t end_byte, int props) { Lisp_Object result, tem, tem1; @@ -2459,7 +2449,7 @@ make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte, in the current buffer, if necessary. */ static void -update_buffer_properties (EMACS_INT start, EMACS_INT end) +update_buffer_properties (ptrdiff_t start, ptrdiff_t end) { /* If this buffer has some access functions, call them, specifying the range of the buffer being accessed. */ @@ -2498,7 +2488,7 @@ into the result string; if you don't want the text properties, use `buffer-substring-no-properties' instead. */) (Lisp_Object start, Lisp_Object end) { - register EMACS_INT b, e; + register ptrdiff_t b, e; validate_region (&start, &end); b = XINT (start); @@ -2514,7 +2504,7 @@ The two arguments START and END are character positions; they can be in either order. */) (Lisp_Object start, Lisp_Object end) { - register EMACS_INT b, e; + register ptrdiff_t b, e; validate_region (&start, &end); b = XINT (start); @@ -2598,8 +2588,8 @@ determines whether case is significant or ignored. */) register Lisp_Object trt = (!NILP (BVAR (current_buffer, case_fold_search)) ? BVAR (current_buffer, case_canon_table) : Qnil); - EMACS_INT chars = 0; - EMACS_INT i1, i2, i1_byte, i2_byte; + ptrdiff_t chars = 0; + ptrdiff_t i1, i2, i1_byte, i2_byte; /* Find the first buffer and its substring. */ @@ -2760,21 +2750,21 @@ and don't mark the buffer as really changed. Both characters must have the same length of multi-byte form. */) (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo) { - register EMACS_INT pos, pos_byte, stop, i, len, end_byte; + register ptrdiff_t pos, pos_byte, stop, i, len, end_byte; /* Keep track of the first change in the buffer: if 0 we haven't found it yet. if < 0 we've found it and we've run the before-change-function. if > 0 we've actually performed it and the value is its position. */ - EMACS_INT changed = 0; + ptrdiff_t changed = 0; unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH]; unsigned char *p; - int count = SPECPDL_INDEX (); + ptrdiff_t count = SPECPDL_INDEX (); #define COMBINING_NO 0 #define COMBINING_BEFORE 1 #define COMBINING_AFTER 2 #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) int maybe_byte_combining = COMBINING_NO; - EMACS_INT last_changed = 0; + ptrdiff_t last_changed = 0; int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); int fromc, toc; @@ -2834,7 +2824,7 @@ Both characters must have the same length of multi-byte form. */) stop = min (stop, GPT_BYTE); while (1) { - EMACS_INT pos_byte_next = pos_byte; + ptrdiff_t pos_byte_next = pos_byte; if (pos_byte >= stop) { @@ -2937,7 +2927,7 @@ Both characters must have the same length of multi-byte form. */) } -static Lisp_Object check_translation (EMACS_INT, EMACS_INT, EMACS_INT, +static Lisp_Object check_translation (ptrdiff_t, ptrdiff_t, ptrdiff_t, Lisp_Object); /* Helper function for Ftranslate_region_internal. @@ -2947,7 +2937,7 @@ static Lisp_Object check_translation (EMACS_INT, EMACS_INT, EMACS_INT, element is found, return it. Otherwise return Qnil. */ static Lisp_Object -check_translation (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT end, +check_translation (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t end, Lisp_Object val) { int buf_size = 16, buf_used = 0; @@ -2956,7 +2946,7 @@ check_translation (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT end, for (; CONSP (val); val = XCDR (val)) { Lisp_Object elt; - EMACS_INT len, i; + ptrdiff_t len, i; elt = XCAR (val); if (! CONSP (elt)) @@ -3009,8 +2999,8 @@ It returns the number of characters changed. */) register unsigned char *tt; /* Trans table. */ register int nc; /* New character. */ int cnt; /* Number of changes made. */ - EMACS_INT size; /* Size of translate table. */ - EMACS_INT pos, pos_byte, end_pos; + ptrdiff_t size; /* Size of translate table. */ + ptrdiff_t pos, pos_byte, end_pos; int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); int string_multibyte IF_LINT (= 0); @@ -3253,7 +3243,7 @@ save_restriction_save (void) end = buildmark (ZV, ZV_BYTE); /* END must move forward if text is inserted at its exact location. */ - XMARKER(end)->insertion_type = 1; + XMARKER (end)->insertion_type = 1; return Fcons (beg, end); } @@ -3288,7 +3278,7 @@ save_restriction_restore (Lisp_Object data) /* The restriction has changed from the saved one, so restore the saved restriction. */ { - EMACS_INT pt = BUF_PT (buf); + ptrdiff_t pt = BUF_PT (buf); SET_BUF_BEGV_BOTH (buf, beg->charpos, beg->bytepos); SET_BUF_ZV_BOTH (buf, end->charpos, end->bytepos); @@ -3346,7 +3336,7 @@ usage: (save-restriction &rest BODY) */) (Lisp_Object body) { register Lisp_Object val; - int count = SPECPDL_INDEX (); + ptrdiff_t count = SPECPDL_INDEX (); record_unwind_protect (save_restriction_restore, save_restriction_save ()); val = Fprogn (body); @@ -3357,7 +3347,7 @@ usage: (save-restriction &rest BODY) */) static char *message_text; /* Allocated length of that buffer. */ -static int message_length; +static ptrdiff_t message_length; DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, doc: /* Display a message at the bottom of the screen. @@ -3439,8 +3429,8 @@ usage: (message-box FORMAT-STRING &rest ARGS) */) } if (SBYTES (val) > message_length) { + message_text = (char *) xrealloc (message_text, SBYTES (val)); message_length = SBYTES (val); - message_text = (char *)xrealloc (message_text, message_length); } memcpy (message_text, SDATA (val), SBYTES (val)); message2 (message_text, SBYTES (val), @@ -3564,12 +3554,12 @@ usage: (format STRING &rest OBJECTS) */) ptrdiff_t n; /* The number of the next arg to substitute */ char initial_buffer[4000]; char *buf = initial_buffer; - EMACS_INT bufsize = sizeof initial_buffer; - EMACS_INT max_bufsize = STRING_BYTES_BOUND + 1; + ptrdiff_t bufsize = sizeof initial_buffer; + ptrdiff_t max_bufsize = STRING_BYTES_BOUND + 1; char *p; Lisp_Object buf_save_value IF_LINT (= {0}); register char *format, *end, *format_start; - EMACS_INT formatlen, nchars; + ptrdiff_t formatlen, nchars; /* Nonzero if the format is multibyte. */ int multibyte_format = 0; /* Nonzero if the output should be a multibyte string, @@ -3596,7 +3586,7 @@ usage: (format STRING &rest OBJECTS) */) info[0] is unused. Unused elements have -1 for start. */ struct info { - EMACS_INT start, end; + ptrdiff_t start, end; int converted_to_string; int intervals; } *info = 0; @@ -3653,7 +3643,7 @@ usage: (format STRING &rest OBJECTS) */) char *format0 = format; /* Bytes needed to represent the output of this conversion. */ - EMACS_INT convbytes; + ptrdiff_t convbytes; if (*format == '%') { @@ -3680,7 +3670,7 @@ usage: (format STRING &rest OBJECTS) */) int space_flag = 0; int sharp_flag = 0; int zero_flag = 0; - EMACS_INT field_width; + ptrdiff_t field_width; int precision_given; uintmax_t precision = UINTMAX_MAX; char *num_end; @@ -3787,11 +3777,11 @@ usage: (format STRING &rest OBJECTS) */) { /* handle case (precision[n] >= 0) */ - EMACS_INT width, padding, nbytes; - EMACS_INT nchars_string; + ptrdiff_t width, padding, nbytes; + ptrdiff_t nchars_string; - EMACS_INT prec = -1; - if (precision_given && precision <= TYPE_MAXIMUM (EMACS_INT)) + ptrdiff_t prec = -1; + if (precision_given && precision <= TYPE_MAXIMUM (ptrdiff_t)) prec = precision; /* lisp_string_width ignores a precision of 0, but GNU @@ -3804,7 +3794,7 @@ usage: (format STRING &rest OBJECTS) */) width = nchars_string = nbytes = 0; else { - EMACS_INT nch, nby; + ptrdiff_t nch, nby; width = lisp_string_width (args[n], prec, &nch, &nby); if (prec < 0) { @@ -3889,7 +3879,7 @@ usage: (format STRING &rest OBJECTS) */) : -1)), /* Maximum number of bytes generated by any format, if - precision is no more than DBL_USEFUL_PRECISION_MAX. + precision is no more than USEFUL_PRECISION_MAX. On all practical hosts, %f is the worst case. */ SPRINTF_BUFSIZE = sizeof "-." + (DBL_MAX_10_EXP + 1) + USEFUL_PRECISION_MAX, @@ -3901,7 +3891,7 @@ usage: (format STRING &rest OBJECTS) */) verify (0 < USEFUL_PRECISION_MAX); int prec; - EMACS_INT padding, sprintf_bytes; + ptrdiff_t padding, sprintf_bytes; uintmax_t excess_precision, numwidth; uintmax_t leading_zeros = 0, trailing_zeros = 0; @@ -4136,8 +4126,8 @@ usage: (format STRING &rest OBJECTS) */) format++; while (! CHAR_HEAD_P (*format)); - convbytes = format - format0; - memset (&discarded[format0 + 1 - format_start], 2, convbytes - 1); + convbytes = format - src; + memset (&discarded[src + 1 - format_start], 2, convbytes - 1); } else { @@ -4165,7 +4155,7 @@ usage: (format STRING &rest OBJECTS) */) character. CONVBYTES says how much room is needed. Allocate enough room (and then some) and do it again. */ { - EMACS_INT used = p - buf; + ptrdiff_t used = p - buf; if (max_bufsize - used < convbytes) string_overflow (); @@ -4216,8 +4206,8 @@ usage: (format STRING &rest OBJECTS) */) if (CONSP (props)) { - EMACS_INT bytepos = 0, position = 0, translated = 0; - EMACS_INT argn = 1; + ptrdiff_t bytepos = 0, position = 0, translated = 0; + ptrdiff_t argn = 1; Lisp_Object list; /* Adjust the bounds of each text property @@ -4235,7 +4225,7 @@ usage: (format STRING &rest OBJECTS) */) for (list = props; CONSP (list); list = XCDR (list)) { Lisp_Object item; - EMACS_INT pos; + ptrdiff_t pos; item = XCAR (list); @@ -4366,12 +4356,12 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) It's the caller's job to ensure that START1 <= END1 <= START2 <= END2. */ static void -transpose_markers (EMACS_INT start1, EMACS_INT end1, - EMACS_INT start2, EMACS_INT end2, - EMACS_INT start1_byte, EMACS_INT end1_byte, - EMACS_INT start2_byte, EMACS_INT end2_byte) +transpose_markers (ptrdiff_t start1, ptrdiff_t end1, + ptrdiff_t start2, ptrdiff_t end2, + ptrdiff_t start1_byte, ptrdiff_t end1_byte, + ptrdiff_t start2_byte, ptrdiff_t end2_byte) { - register EMACS_INT amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos; + register ptrdiff_t amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos; register struct Lisp_Marker *marker; /* Update point as if it were a marker. */ @@ -4445,9 +4435,9 @@ any markers that happen to be located in the regions. Transposing beyond buffer boundaries is an error. */) (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers) { - register EMACS_INT start1, end1, start2, end2; - EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte; - EMACS_INT gap, len1, len_mid, len2; + register ptrdiff_t start1, end1, start2, end2; + ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte; + ptrdiff_t gap, len1, len_mid, len2; unsigned char *start1_addr, *start2_addr, *temp; INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3; @@ -4468,7 +4458,7 @@ Transposing beyond buffer boundaries is an error. */) /* Swap the regions if they're reversed. */ if (start2 < end1) { - register EMACS_INT glumph = start1; + register ptrdiff_t glumph = start1; start1 = start2; start2 = glumph; glumph = end1;