Mercurial > emacs
comparison src/editfns.c @ 23166:6072f28afec9
(Ftranspose_regions): Use BYTE_POS_ADDR to get an
address in buffer from byte-position.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 02 Sep 1998 04:51:42 +0000 |
parents | 1c8e0e09aea1 |
children | 0d3baa5514b7 |
comparison
equal
deleted
inserted
replaced
23165:0e28574df9af | 23166:6072f28afec9 |
---|---|
2983 temp = (unsigned char *) alloca (len2_byte); | 2983 temp = (unsigned char *) alloca (len2_byte); |
2984 | 2984 |
2985 /* Don't precompute these addresses. We have to compute them | 2985 /* Don't precompute these addresses. We have to compute them |
2986 at the last minute, because the relocating allocator might | 2986 at the last minute, because the relocating allocator might |
2987 have moved the buffer around during the xmalloc. */ | 2987 have moved the buffer around during the xmalloc. */ |
2988 start1_addr = BUF_CHAR_ADDRESS (current_buffer, start1_byte); | 2988 start1_addr = BYTE_POS_ADDR (start1_byte); |
2989 start2_addr = BUF_CHAR_ADDRESS (current_buffer, start2_byte); | 2989 start2_addr = BYTE_POS_ADDR (start2_byte); |
2990 | 2990 |
2991 bcopy (start2_addr, temp, len2_byte); | 2991 bcopy (start2_addr, temp, len2_byte); |
2992 bcopy (start1_addr, start1_addr + len2_byte, len1_byte); | 2992 bcopy (start1_addr, start1_addr + len2_byte, len1_byte); |
2993 bcopy (temp, start1_addr, len2_byte); | 2993 bcopy (temp, start1_addr, len2_byte); |
2994 if (len2_byte > 20000) | 2994 if (len2_byte > 20000) |
2999 { | 2999 { |
3000 if (len1_byte > 20000) | 3000 if (len1_byte > 20000) |
3001 temp = (unsigned char *) xmalloc (len1_byte); | 3001 temp = (unsigned char *) xmalloc (len1_byte); |
3002 else | 3002 else |
3003 temp = (unsigned char *) alloca (len1_byte); | 3003 temp = (unsigned char *) alloca (len1_byte); |
3004 start1_addr = BUF_CHAR_ADDRESS (current_buffer, start1_byte); | 3004 start1_addr = BYTE_POS_ADDR (start1_byte); |
3005 start2_addr = BUF_CHAR_ADDRESS (current_buffer, start2_byte); | 3005 start2_addr = BYTE_POS_ADDR (start2_byte); |
3006 bcopy (start1_addr, temp, len1_byte); | 3006 bcopy (start1_addr, temp, len1_byte); |
3007 bcopy (start2_addr, start1_addr, len2_byte); | 3007 bcopy (start2_addr, start1_addr, len2_byte); |
3008 bcopy (temp, start1_addr + len2_byte, len1_byte); | 3008 bcopy (temp, start1_addr + len2_byte, len1_byte); |
3009 if (len1_byte > 20000) | 3009 if (len1_byte > 20000) |
3010 free (temp); | 3010 free (temp); |
3039 | 3039 |
3040 if (len1_byte > 20000) | 3040 if (len1_byte > 20000) |
3041 temp = (unsigned char *) xmalloc (len1_byte); | 3041 temp = (unsigned char *) xmalloc (len1_byte); |
3042 else | 3042 else |
3043 temp = (unsigned char *) alloca (len1_byte); | 3043 temp = (unsigned char *) alloca (len1_byte); |
3044 start1_addr = BUF_CHAR_ADDRESS (current_buffer, start1_byte); | 3044 start1_addr = BYTE_POS_ADDR (start1_byte); |
3045 start2_addr = BUF_CHAR_ADDRESS (current_buffer, start2_byte); | 3045 start2_addr = BYTE_POS_ADDR (start2_byte); |
3046 bcopy (start1_addr, temp, len1_byte); | 3046 bcopy (start1_addr, temp, len1_byte); |
3047 bcopy (start2_addr, start1_addr, len2_byte); | 3047 bcopy (start2_addr, start1_addr, len2_byte); |
3048 bcopy (temp, start2_addr, len1_byte); | 3048 bcopy (temp, start2_addr, len1_byte); |
3049 if (len1_byte > 20000) | 3049 if (len1_byte > 20000) |
3050 free (temp); | 3050 free (temp); |
3072 /* holds region 2 */ | 3072 /* holds region 2 */ |
3073 if (len2_byte > 20000) | 3073 if (len2_byte > 20000) |
3074 temp = (unsigned char *) xmalloc (len2_byte); | 3074 temp = (unsigned char *) xmalloc (len2_byte); |
3075 else | 3075 else |
3076 temp = (unsigned char *) alloca (len2_byte); | 3076 temp = (unsigned char *) alloca (len2_byte); |
3077 start1_addr = BUF_CHAR_ADDRESS (current_buffer, start1_byte); | 3077 start1_addr = BYTE_POS_ADDR (start1_byte); |
3078 start2_addr = BUF_CHAR_ADDRESS (current_buffer, start2_byte); | 3078 start2_addr = BYTE_POS_ADDR (start2_byte); |
3079 bcopy (start2_addr, temp, len2_byte); | 3079 bcopy (start2_addr, temp, len2_byte); |
3080 bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte); | 3080 bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte); |
3081 safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); | 3081 safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); |
3082 bcopy (temp, start1_addr, len2_byte); | 3082 bcopy (temp, start1_addr, len2_byte); |
3083 if (len2_byte > 20000) | 3083 if (len2_byte > 20000) |
3108 /* holds region 1 */ | 3108 /* holds region 1 */ |
3109 if (len1_byte > 20000) | 3109 if (len1_byte > 20000) |
3110 temp = (unsigned char *) xmalloc (len1_byte); | 3110 temp = (unsigned char *) xmalloc (len1_byte); |
3111 else | 3111 else |
3112 temp = (unsigned char *) alloca (len1_byte); | 3112 temp = (unsigned char *) alloca (len1_byte); |
3113 start1_addr = BUF_CHAR_ADDRESS (current_buffer, start1_byte); | 3113 start1_addr = BYTE_POS_ADDR (start1_byte); |
3114 start2_addr = BUF_CHAR_ADDRESS (current_buffer, start2_byte); | 3114 start2_addr = BYTE_POS_ADDR (start2_byte); |
3115 bcopy (start1_addr, temp, len1_byte); | 3115 bcopy (start1_addr, temp, len1_byte); |
3116 bcopy (start2_addr, start1_addr, len2_byte); | 3116 bcopy (start2_addr, start1_addr, len2_byte); |
3117 bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); | 3117 bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); |
3118 bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte); | 3118 bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte); |
3119 if (len1_byte > 20000) | 3119 if (len1_byte > 20000) |