diff options
| author | Andreas Schwab | 2013-03-24 13:59:45 +0100 |
|---|---|---|
| committer | Andreas Schwab | 2013-03-24 13:59:45 +0100 |
| commit | 908589fd28437a9b0995b103e22ce5e4d421eb8a (patch) | |
| tree | ce3a4207b04f84fdc97ee1ca2dfbc369fcf07c2a /src/intervals.c | |
| parent | 7b0e2f853fcd88c58715fd159923d50dfdeb9cba (diff) | |
| download | emacs-908589fd28437a9b0995b103e22ce5e4d421eb8a.tar.gz emacs-908589fd28437a9b0995b103e22ce5e4d421eb8a.zip | |
Reorder conditions that are written backwards
* alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are
written backwards.
* blockinput.h (input_blocked_p): Likewise.
* bytecode.c (exec_byte_code): Likewise.
* callproc.c (call_process_kill, call_process_cleanup)
(Fcall_process): Likewise.
* ccl.c (ccl_driver, resolve_symbol_ccl_program)
(Fccl_execute_on_string): Likewise.
* character.c (string_escape_byte8): Likewise.
* charset.c (read_hex): Likewise.
* cm.c (calccost): Likewise.
* data.c (cons_to_unsigned): Likewise.
* dired.c (directory_files_internal, file_name_completion):
Likewise.
* dispnew.c (scrolling_window, update_frame_1, Fsleep_for)
(sit_for): Likewise.
* doc.c (Fsubstitute_command_keys): Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (hi_time, decode_time_components, Fformat): Likewise.
* emacsgtkfixed.c: Likewise.
* fileio.c (file_offset, Fwrite_region): Likewise.
* floatfns.c (Fexpt, fmod_float): Likewise.
* fns.c (larger_vector, make_hash_table, Fmake_hash_table):
Likewise.
* font.c (font_intern_prop): Likewise.
* frame.c (x_set_alpha): Likewise.
* gtkutil.c (get_utf8_string): Likewise.
* indent.c (check_display_width): Likewise.
* intervals.c (create_root_interval, rotate_right, rotate_left)
(split_interval_right, split_interval_left)
(adjust_intervals_for_insertion, delete_node)
(interval_deletion_adjustment, adjust_intervals_for_deletion)
(merge_interval_right, merge_interval_left, copy_intervals)
(set_intervals_multibyte_1): Likewise.
* keyboard.c (gobble_input, append_tool_bar_item): Likewise.
* keymap.c (Fkey_description): Likewise.
* lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise.
* lread.c (openp, read_integer, read1, string_to_number):
Likewise.
* menu.c (ensure_menu_items): Likewise.
* minibuf.c (read_minibuf_noninteractive): Likewise.
* print.c (printchar, strout): Likewise.
* process.c (create_process, Faccept_process_output)
(wait_reading_process_output, read_process_output, send_process)
(wait_reading_process_output): Likewise.
* profiler.c (make_log, handle_profiler_signal): Likewise.
* regex.c (re_exec): Likewise.
* regex.h: Likewise.
* search.c (looking_at_1, Freplace_match): Likewise.
* sysdep.c (get_child_status, procfs_ttyname)
(procfs_get_total_memory): Likewise.
* systime.h (EMACS_TIME_VALID_P): Likewise.
* term.c (dissociate_if_controlling_tty): Likewise.
* window.c (get_phys_cursor_glyph): Likewise.
* xdisp.c (init_iterator, redisplay_internal, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, pint2hrstr):
Likewise.
* xfns.c (Fx_window_property): Likewise.
* xmenu.c (set_frame_menubar): Likewise.
* xselect.c (x_get_window_property, x_handle_dnd_message):
Likewise.
* xsmfns.c (smc_save_yourself_CB): Likewise.
* xterm.c (x_scroll_bar_set_handle): Likewise.
Diffstat (limited to 'src/intervals.c')
| -rw-r--r-- | src/intervals.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/intervals.c b/src/intervals.c index db38c86c00b..f65ce0ecc77 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -110,14 +110,14 @@ create_root_interval (Lisp_Object parent) | |||
| 110 | { | 110 | { |
| 111 | new->total_length = (BUF_Z (XBUFFER (parent)) | 111 | new->total_length = (BUF_Z (XBUFFER (parent)) |
| 112 | - BUF_BEG (XBUFFER (parent))); | 112 | - BUF_BEG (XBUFFER (parent))); |
| 113 | eassert (0 <= TOTAL_LENGTH (new)); | 113 | eassert (TOTAL_LENGTH (new) >= 0); |
| 114 | set_buffer_intervals (XBUFFER (parent), new); | 114 | set_buffer_intervals (XBUFFER (parent), new); |
| 115 | new->position = BEG; | 115 | new->position = BEG; |
| 116 | } | 116 | } |
| 117 | else if (STRINGP (parent)) | 117 | else if (STRINGP (parent)) |
| 118 | { | 118 | { |
| 119 | new->total_length = SCHARS (parent); | 119 | new->total_length = SCHARS (parent); |
| 120 | eassert (0 <= TOTAL_LENGTH (new)); | 120 | eassert (TOTAL_LENGTH (new) >= 0); |
| 121 | set_string_intervals (parent, new); | 121 | set_string_intervals (parent, new); |
| 122 | new->position = 0; | 122 | new->position = 0; |
| 123 | } | 123 | } |
| @@ -371,11 +371,11 @@ rotate_right (INTERVAL interval) | |||
| 371 | 371 | ||
| 372 | /* A's total length is decreased by the length of B and its left child. */ | 372 | /* A's total length is decreased by the length of B and its left child. */ |
| 373 | interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); | 373 | interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); |
| 374 | eassert (0 <= TOTAL_LENGTH (interval)); | 374 | eassert (TOTAL_LENGTH (interval) >= 0); |
| 375 | 375 | ||
| 376 | /* B must have the same total length of A. */ | 376 | /* B must have the same total length of A. */ |
| 377 | B->total_length = old_total; | 377 | B->total_length = old_total; |
| 378 | eassert (0 <= TOTAL_LENGTH (B)); | 378 | eassert (TOTAL_LENGTH (B) >= 0); |
| 379 | 379 | ||
| 380 | return B; | 380 | return B; |
| 381 | } | 381 | } |
| @@ -418,11 +418,11 @@ rotate_left (INTERVAL interval) | |||
| 418 | 418 | ||
| 419 | /* A's total length is decreased by the length of B and its right child. */ | 419 | /* A's total length is decreased by the length of B and its right child. */ |
| 420 | interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); | 420 | interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); |
| 421 | eassert (0 <= TOTAL_LENGTH (interval)); | 421 | eassert (TOTAL_LENGTH (interval) >= 0); |
| 422 | 422 | ||
| 423 | /* B must have the same total length of A. */ | 423 | /* B must have the same total length of A. */ |
| 424 | B->total_length = old_total; | 424 | B->total_length = old_total; |
| 425 | eassert (0 <= TOTAL_LENGTH (B)); | 425 | eassert (TOTAL_LENGTH (B) >= 0); |
| 426 | 426 | ||
| 427 | return B; | 427 | return B; |
| 428 | } | 428 | } |
| @@ -556,7 +556,7 @@ split_interval_right (INTERVAL interval, ptrdiff_t offset) | |||
| 556 | { | 556 | { |
| 557 | set_interval_right (interval, new); | 557 | set_interval_right (interval, new); |
| 558 | new->total_length = new_length; | 558 | new->total_length = new_length; |
| 559 | eassert (0 <= TOTAL_LENGTH (new)); | 559 | eassert (TOTAL_LENGTH (new) >= 0); |
| 560 | } | 560 | } |
| 561 | else | 561 | else |
| 562 | { | 562 | { |
| @@ -565,7 +565,7 @@ split_interval_right (INTERVAL interval, ptrdiff_t offset) | |||
| 565 | set_interval_parent (interval->right, new); | 565 | set_interval_parent (interval->right, new); |
| 566 | set_interval_right (interval, new); | 566 | set_interval_right (interval, new); |
| 567 | new->total_length = new_length + new->right->total_length; | 567 | new->total_length = new_length + new->right->total_length; |
| 568 | eassert (0 <= TOTAL_LENGTH (new)); | 568 | eassert (TOTAL_LENGTH (new) >= 0); |
| 569 | balance_an_interval (new); | 569 | balance_an_interval (new); |
| 570 | } | 570 | } |
| 571 | 571 | ||
| @@ -601,7 +601,7 @@ split_interval_left (INTERVAL interval, ptrdiff_t offset) | |||
| 601 | { | 601 | { |
| 602 | set_interval_left (interval, new); | 602 | set_interval_left (interval, new); |
| 603 | new->total_length = new_length; | 603 | new->total_length = new_length; |
| 604 | eassert (0 <= TOTAL_LENGTH (new)); | 604 | eassert (TOTAL_LENGTH (new) >= 0); |
| 605 | } | 605 | } |
| 606 | else | 606 | else |
| 607 | { | 607 | { |
| @@ -610,7 +610,7 @@ split_interval_left (INTERVAL interval, ptrdiff_t offset) | |||
| 610 | set_interval_parent (new->left, new); | 610 | set_interval_parent (new->left, new); |
| 611 | set_interval_left (interval, new); | 611 | set_interval_left (interval, new); |
| 612 | new->total_length = new_length + new->left->total_length; | 612 | new->total_length = new_length + new->left->total_length; |
| 613 | eassert (0 <= TOTAL_LENGTH (new)); | 613 | eassert (TOTAL_LENGTH (new) >= 0); |
| 614 | balance_an_interval (new); | 614 | balance_an_interval (new); |
| 615 | } | 615 | } |
| 616 | 616 | ||
| @@ -960,7 +960,7 @@ adjust_intervals_for_insertion (INTERVAL tree, | |||
| 960 | for (temp = prev ? prev : i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) | 960 | for (temp = prev ? prev : i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) |
| 961 | { | 961 | { |
| 962 | temp->total_length += length; | 962 | temp->total_length += length; |
| 963 | eassert (0 <= TOTAL_LENGTH (temp)); | 963 | eassert (TOTAL_LENGTH (temp) >= 0); |
| 964 | temp = balance_possible_root_interval (temp); | 964 | temp = balance_possible_root_interval (temp); |
| 965 | } | 965 | } |
| 966 | 966 | ||
| @@ -1016,7 +1016,7 @@ adjust_intervals_for_insertion (INTERVAL tree, | |||
| 1016 | for (temp = i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) | 1016 | for (temp = i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) |
| 1017 | { | 1017 | { |
| 1018 | temp->total_length += length; | 1018 | temp->total_length += length; |
| 1019 | eassert (0 <= TOTAL_LENGTH (temp)); | 1019 | eassert (TOTAL_LENGTH (temp) >= 0); |
| 1020 | temp = balance_possible_root_interval (temp); | 1020 | temp = balance_possible_root_interval (temp); |
| 1021 | } | 1021 | } |
| 1022 | } | 1022 | } |
| @@ -1218,7 +1218,7 @@ delete_node (register INTERVAL i) | |||
| 1218 | this = this->left; | 1218 | this = this->left; |
| 1219 | this->total_length += migrate_amt; | 1219 | this->total_length += migrate_amt; |
| 1220 | } | 1220 | } |
| 1221 | eassert (0 <= TOTAL_LENGTH (this)); | 1221 | eassert (TOTAL_LENGTH (this) >= 0); |
| 1222 | set_interval_left (this, migrate); | 1222 | set_interval_left (this, migrate); |
| 1223 | set_interval_parent (migrate, this); | 1223 | set_interval_parent (migrate, this); |
| 1224 | 1224 | ||
| @@ -1300,7 +1300,7 @@ interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from, | |||
| 1300 | relative_position, | 1300 | relative_position, |
| 1301 | amount); | 1301 | amount); |
| 1302 | tree->total_length -= subtract; | 1302 | tree->total_length -= subtract; |
| 1303 | eassert (0 <= TOTAL_LENGTH (tree)); | 1303 | eassert (TOTAL_LENGTH (tree) >= 0); |
| 1304 | return subtract; | 1304 | return subtract; |
| 1305 | } | 1305 | } |
| 1306 | /* Right branch. */ | 1306 | /* Right branch. */ |
| @@ -1315,7 +1315,7 @@ interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from, | |||
| 1315 | relative_position, | 1315 | relative_position, |
| 1316 | amount); | 1316 | amount); |
| 1317 | tree->total_length -= subtract; | 1317 | tree->total_length -= subtract; |
| 1318 | eassert (0 <= TOTAL_LENGTH (tree)); | 1318 | eassert (TOTAL_LENGTH (tree) >= 0); |
| 1319 | return subtract; | 1319 | return subtract; |
| 1320 | } | 1320 | } |
| 1321 | /* Here -- this node. */ | 1321 | /* Here -- this node. */ |
| @@ -1330,7 +1330,7 @@ interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from, | |||
| 1330 | amount = my_amount; | 1330 | amount = my_amount; |
| 1331 | 1331 | ||
| 1332 | tree->total_length -= amount; | 1332 | tree->total_length -= amount; |
| 1333 | eassert (0 <= TOTAL_LENGTH (tree)); | 1333 | eassert (TOTAL_LENGTH (tree) >= 0); |
| 1334 | if (LENGTH (tree) == 0) | 1334 | if (LENGTH (tree) == 0) |
| 1335 | delete_interval (tree); | 1335 | delete_interval (tree); |
| 1336 | 1336 | ||
| @@ -1372,7 +1372,7 @@ adjust_intervals_for_deletion (struct buffer *buffer, | |||
| 1372 | if (ONLY_INTERVAL_P (tree)) | 1372 | if (ONLY_INTERVAL_P (tree)) |
| 1373 | { | 1373 | { |
| 1374 | tree->total_length -= length; | 1374 | tree->total_length -= length; |
| 1375 | eassert (0 <= TOTAL_LENGTH (tree)); | 1375 | eassert (TOTAL_LENGTH (tree) >= 0); |
| 1376 | return; | 1376 | return; |
| 1377 | } | 1377 | } |
| 1378 | 1378 | ||
| @@ -1435,19 +1435,19 @@ merge_interval_right (register INTERVAL i) | |||
| 1435 | while (! NULL_LEFT_CHILD (successor)) | 1435 | while (! NULL_LEFT_CHILD (successor)) |
| 1436 | { | 1436 | { |
| 1437 | successor->total_length += absorb; | 1437 | successor->total_length += absorb; |
| 1438 | eassert (0 <= TOTAL_LENGTH (successor)); | 1438 | eassert (TOTAL_LENGTH (successor) >= 0); |
| 1439 | successor = successor->left; | 1439 | successor = successor->left; |
| 1440 | } | 1440 | } |
| 1441 | 1441 | ||
| 1442 | successor->total_length += absorb; | 1442 | successor->total_length += absorb; |
| 1443 | eassert (0 <= TOTAL_LENGTH (successor)); | 1443 | eassert (TOTAL_LENGTH (successor) >= 0); |
| 1444 | delete_interval (i); | 1444 | delete_interval (i); |
| 1445 | return successor; | 1445 | return successor; |
| 1446 | } | 1446 | } |
| 1447 | 1447 | ||
| 1448 | /* Zero out this interval. */ | 1448 | /* Zero out this interval. */ |
| 1449 | i->total_length -= absorb; | 1449 | i->total_length -= absorb; |
| 1450 | eassert (0 <= TOTAL_LENGTH (i)); | 1450 | eassert (TOTAL_LENGTH (i) >= 0); |
| 1451 | 1451 | ||
| 1452 | successor = i; | 1452 | successor = i; |
| 1453 | while (! NULL_PARENT (successor)) /* It's above us. Subtract as | 1453 | while (! NULL_PARENT (successor)) /* It's above us. Subtract as |
| @@ -1462,7 +1462,7 @@ merge_interval_right (register INTERVAL i) | |||
| 1462 | 1462 | ||
| 1463 | successor = INTERVAL_PARENT (successor); | 1463 | successor = INTERVAL_PARENT (successor); |
| 1464 | successor->total_length -= absorb; | 1464 | successor->total_length -= absorb; |
| 1465 | eassert (0 <= TOTAL_LENGTH (successor)); | 1465 | eassert (TOTAL_LENGTH (successor) >= 0); |
| 1466 | } | 1466 | } |
| 1467 | 1467 | ||
| 1468 | /* This must be the rightmost or last interval and cannot | 1468 | /* This must be the rightmost or last interval and cannot |
| @@ -1491,19 +1491,19 @@ merge_interval_left (register INTERVAL i) | |||
| 1491 | while (! NULL_RIGHT_CHILD (predecessor)) | 1491 | while (! NULL_RIGHT_CHILD (predecessor)) |
| 1492 | { | 1492 | { |
| 1493 | predecessor->total_length += absorb; | 1493 | predecessor->total_length += absorb; |
| 1494 | eassert (0 <= TOTAL_LENGTH (predecessor)); | 1494 | eassert (TOTAL_LENGTH (predecessor) >= 0); |
| 1495 | predecessor = predecessor->right; | 1495 | predecessor = predecessor->right; |
| 1496 | } | 1496 | } |
| 1497 | 1497 | ||
| 1498 | predecessor->total_length += absorb; | 1498 | predecessor->total_length += absorb; |
| 1499 | eassert (0 <= TOTAL_LENGTH (predecessor)); | 1499 | eassert (TOTAL_LENGTH (predecessor) >= 0); |
| 1500 | delete_interval (i); | 1500 | delete_interval (i); |
| 1501 | return predecessor; | 1501 | return predecessor; |
| 1502 | } | 1502 | } |
| 1503 | 1503 | ||
| 1504 | /* Zero out this interval. */ | 1504 | /* Zero out this interval. */ |
| 1505 | i->total_length -= absorb; | 1505 | i->total_length -= absorb; |
| 1506 | eassert (0 <= TOTAL_LENGTH (i)); | 1506 | eassert (TOTAL_LENGTH (i) >= 0); |
| 1507 | 1507 | ||
| 1508 | predecessor = i; | 1508 | predecessor = i; |
| 1509 | while (! NULL_PARENT (predecessor)) /* It's above us. Go up, | 1509 | while (! NULL_PARENT (predecessor)) /* It's above us. Go up, |
| @@ -1518,7 +1518,7 @@ merge_interval_left (register INTERVAL i) | |||
| 1518 | 1518 | ||
| 1519 | predecessor = INTERVAL_PARENT (predecessor); | 1519 | predecessor = INTERVAL_PARENT (predecessor); |
| 1520 | predecessor->total_length -= absorb; | 1520 | predecessor->total_length -= absorb; |
| 1521 | eassert (0 <= TOTAL_LENGTH (predecessor)); | 1521 | eassert (TOTAL_LENGTH (predecessor) >= 0); |
| 1522 | } | 1522 | } |
| 1523 | 1523 | ||
| 1524 | /* This must be the leftmost or first interval and cannot | 1524 | /* This must be the leftmost or first interval and cannot |
| @@ -2272,7 +2272,7 @@ copy_intervals (INTERVAL tree, ptrdiff_t start, ptrdiff_t length) | |||
| 2272 | new->position = 0; | 2272 | new->position = 0; |
| 2273 | got = (LENGTH (i) - (start - i->position)); | 2273 | got = (LENGTH (i) - (start - i->position)); |
| 2274 | new->total_length = length; | 2274 | new->total_length = length; |
| 2275 | eassert (0 <= TOTAL_LENGTH (new)); | 2275 | eassert (TOTAL_LENGTH (new) >= 0); |
| 2276 | copy_properties (i, new); | 2276 | copy_properties (i, new); |
| 2277 | 2277 | ||
| 2278 | t = new; | 2278 | t = new; |
| @@ -2355,7 +2355,7 @@ set_intervals_multibyte_1 (INTERVAL i, bool multi_flag, | |||
| 2355 | i->total_length = end - start; | 2355 | i->total_length = end - start; |
| 2356 | else | 2356 | else |
| 2357 | i->total_length = end_byte - start_byte; | 2357 | i->total_length = end_byte - start_byte; |
| 2358 | eassert (0 <= TOTAL_LENGTH (i)); | 2358 | eassert (TOTAL_LENGTH (i) >= 0); |
| 2359 | 2359 | ||
| 2360 | if (TOTAL_LENGTH (i) == 0) | 2360 | if (TOTAL_LENGTH (i) == 0) |
| 2361 | { | 2361 | { |