comparison src/extents.c @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents ac2d302a0011
children 0293115a14e9
comparison
equal deleted inserted replaced
13:13c6d0aaafe5 14:9ee227acff29
1966 { 1966 {
1967 assert (EQ (obj, extent_object (after))); 1967 assert (EQ (obj, extent_object (after)));
1968 assert (!extent_detached_p (after)); 1968 assert (!extent_detached_p (after));
1969 } 1969 }
1970 1970
1971 if (!buffer_or_string_extent_list (obj)) 1971 el = buffer_or_string_extent_list (obj);
1972 if (!el || !extent_list_num_els(el))
1972 return; 1973 return;
1974 el = 0;
1973 1975
1974 st = buffer_or_string_bytind_to_memind (obj, from); 1976 st = buffer_or_string_bytind_to_memind (obj, from);
1975 en = buffer_or_string_bytind_to_memind (obj, to); 1977 en = buffer_or_string_bytind_to_memind (obj, to);
1976 1978
1977 if (flags & ME_MIGHT_MODIFY_TEXT) 1979 if (flags & ME_MIGHT_MODIFY_TEXT)
2313 #ifdef ERROR_CHECK_EXTENTS 2315 #ifdef ERROR_CHECK_EXTENTS
2314 sledgehammer_extent_check (obj); 2316 sledgehammer_extent_check (obj);
2315 #endif 2317 #endif
2316 el = buffer_or_string_extent_list (obj); 2318 el = buffer_or_string_extent_list (obj);
2317 2319
2318 if (!el) 2320 if (!el || !extent_list_num_els(el))
2319 return; 2321 return;
2322
2320 /* IMPORTANT! Compute the starting positions of the extents to 2323 /* IMPORTANT! Compute the starting positions of the extents to
2321 modify BEFORE doing any modification! Otherwise the starting 2324 modify BEFORE doing any modification! Otherwise the starting
2322 position for the second time through the loop might get 2325 position for the second time through the loop might get
2323 incorrectly calculated (I got bit by this bug real bad). */ 2326 incorrectly calculated (I got bit by this bug real bad). */
2324 startpos[0] = extent_list_locate_from_pos (el, from+1, 0); 2327 startpos[0] = extent_list_locate_from_pos (el, from+1, 0);
2514 Memind mempos = buffer_or_string_bytind_to_memind (obj, pos); 2517 Memind mempos = buffer_or_string_bytind_to_memind (obj, pos);
2515 Bytind limit = outside_accessible ? 2518 Bytind limit = outside_accessible ?
2516 buffer_or_string_absolute_end_byte (obj) : 2519 buffer_or_string_absolute_end_byte (obj) :
2517 buffer_or_string_accessible_end_byte (obj); 2520 buffer_or_string_accessible_end_byte (obj);
2518 2521
2519 if (!bel) 2522 if (!bel || !extent_list_num_els(bel))
2520 return limit; 2523 return limit;
2521 2524
2522 sel = buffer_or_string_stack_of_extents_force (obj)->extents; 2525 sel = buffer_or_string_stack_of_extents_force (obj)->extents;
2523 soe_move (obj, mempos); 2526 soe_move (obj, mempos);
2524 2527
2554 Memind mempos = buffer_or_string_bytind_to_memind (obj, pos); 2557 Memind mempos = buffer_or_string_bytind_to_memind (obj, pos);
2555 Bytind limit = outside_accessible ? 2558 Bytind limit = outside_accessible ?
2556 buffer_or_string_absolute_begin_byte (obj) : 2559 buffer_or_string_absolute_begin_byte (obj) :
2557 buffer_or_string_accessible_begin_byte (obj); 2560 buffer_or_string_accessible_begin_byte (obj);
2558 2561
2559 if (!bel) 2562 if (!bel || !extent_list_num_els(bel))
2560 return limit; 2563 return limit;
2561 2564
2562 sel = buffer_or_string_stack_of_extents_force (obj)->extents; 2565 sel = buffer_or_string_stack_of_extents_force (obj)->extents;
2563 soe_move (obj, mempos); 2566 soe_move (obj, mempos);
2564 2567