Mercurial > emacs
comparison src/fns.c @ 57726:66e97a54985f
Fix SAFE_FREE calls. Replace SAFE_FREE_LISP calls.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Tue, 26 Oct 2004 22:38:50 +0000 |
parents | 72eb85758337 |
children | 75429b9aa2f2 3a5b83e18d41 |
comparison
equal
deleted
inserted
replaced
57725:c0675c413aa3 | 57726:66e97a54985f |
---|---|
1010 SAFE_ALLOCA (buf, unsigned char *, nbytes); | 1010 SAFE_ALLOCA (buf, unsigned char *, nbytes); |
1011 copy_text (SDATA (string), buf, SBYTES (string), | 1011 copy_text (SDATA (string), buf, SBYTES (string), |
1012 0, 1); | 1012 0, 1); |
1013 | 1013 |
1014 ret = make_multibyte_string (buf, SCHARS (string), nbytes); | 1014 ret = make_multibyte_string (buf, SCHARS (string), nbytes); |
1015 SAFE_FREE (nbytes); | 1015 SAFE_FREE (); |
1016 | 1016 |
1017 return ret; | 1017 return ret; |
1018 } | 1018 } |
1019 | 1019 |
1020 | 1020 |
1044 SAFE_ALLOCA (buf, unsigned char *, nbytes); | 1044 SAFE_ALLOCA (buf, unsigned char *, nbytes); |
1045 bcopy (SDATA (string), buf, SBYTES (string)); | 1045 bcopy (SDATA (string), buf, SBYTES (string)); |
1046 str_to_multibyte (buf, nbytes, SBYTES (string)); | 1046 str_to_multibyte (buf, nbytes, SBYTES (string)); |
1047 | 1047 |
1048 ret = make_multibyte_string (buf, SCHARS (string), nbytes); | 1048 ret = make_multibyte_string (buf, SCHARS (string), nbytes); |
1049 SAFE_FREE (nbytes); | 1049 SAFE_FREE (); |
1050 | 1050 |
1051 return ret; | 1051 return ret; |
1052 } | 1052 } |
1053 | 1053 |
1054 | 1054 |
1071 SAFE_ALLOCA (buf, unsigned char *, nchars); | 1071 SAFE_ALLOCA (buf, unsigned char *, nchars); |
1072 copy_text (SDATA (string), buf, SBYTES (string), | 1072 copy_text (SDATA (string), buf, SBYTES (string), |
1073 1, 0); | 1073 1, 0); |
1074 | 1074 |
1075 ret = make_unibyte_string (buf, nchars); | 1075 ret = make_unibyte_string (buf, nchars); |
1076 SAFE_FREE (nchars); | 1076 SAFE_FREE (); |
1077 | 1077 |
1078 return ret; | 1078 return ret; |
1079 } | 1079 } |
1080 | 1080 |
1081 DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte, | 1081 DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte, |
3028 | 3028 |
3029 for (i = 1; i < nargs; i += 2) | 3029 for (i = 1; i < nargs; i += 2) |
3030 args[i] = separator; | 3030 args[i] = separator; |
3031 | 3031 |
3032 ret = Fconcat (nargs, args); | 3032 ret = Fconcat (nargs, args); |
3033 SAFE_FREE_LISP (nargs); | 3033 SAFE_FREE (); |
3034 | 3034 |
3035 return ret; | 3035 return ret; |
3036 } | 3036 } |
3037 | 3037 |
3038 DEFUN ("mapcar", Fmapcar, Smapcar, 2, 2, 0, | 3038 DEFUN ("mapcar", Fmapcar, Smapcar, 2, 2, 0, |
3054 SAFE_ALLOCA_LISP (args, leni); | 3054 SAFE_ALLOCA_LISP (args, leni); |
3055 | 3055 |
3056 mapcar1 (leni, args, function, sequence); | 3056 mapcar1 (leni, args, function, sequence); |
3057 | 3057 |
3058 ret = Flist (leni, args); | 3058 ret = Flist (leni, args); |
3059 SAFE_FREE_LISP (leni); | 3059 SAFE_FREE (); |
3060 | 3060 |
3061 return ret; | 3061 return ret; |
3062 } | 3062 } |
3063 | 3063 |
3064 DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0, | 3064 DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0, |
3761 abort (); | 3761 abort (); |
3762 | 3762 |
3763 if (encoded_length < 0) | 3763 if (encoded_length < 0) |
3764 { | 3764 { |
3765 /* The encoding wasn't possible. */ | 3765 /* The encoding wasn't possible. */ |
3766 SAFE_FREE (allength); | 3766 SAFE_FREE (); |
3767 error ("Multibyte character in data for base64 encoding"); | 3767 error ("Multibyte character in data for base64 encoding"); |
3768 } | 3768 } |
3769 | 3769 |
3770 /* Now we have encoded the region, so we insert the new contents | 3770 /* Now we have encoded the region, so we insert the new contents |
3771 and delete the old. (Insert first in order to preserve markers.) */ | 3771 and delete the old. (Insert first in order to preserve markers.) */ |
3772 SET_PT_BOTH (XFASTINT (beg), ibeg); | 3772 SET_PT_BOTH (XFASTINT (beg), ibeg); |
3773 insert (encoded, encoded_length); | 3773 insert (encoded, encoded_length); |
3774 SAFE_FREE (allength); | 3774 SAFE_FREE (); |
3775 del_range_byte (ibeg + encoded_length, iend + encoded_length, 1); | 3775 del_range_byte (ibeg + encoded_length, iend + encoded_length, 1); |
3776 | 3776 |
3777 /* If point was outside of the region, restore it exactly; else just | 3777 /* If point was outside of the region, restore it exactly; else just |
3778 move to the beginning of the region. */ | 3778 move to the beginning of the region. */ |
3779 if (old_pos >= XFASTINT (end)) | 3779 if (old_pos >= XFASTINT (end)) |
3818 abort (); | 3818 abort (); |
3819 | 3819 |
3820 if (encoded_length < 0) | 3820 if (encoded_length < 0) |
3821 { | 3821 { |
3822 /* The encoding wasn't possible. */ | 3822 /* The encoding wasn't possible. */ |
3823 SAFE_FREE (allength); | 3823 SAFE_FREE (); |
3824 error ("Multibyte character in data for base64 encoding"); | 3824 error ("Multibyte character in data for base64 encoding"); |
3825 } | 3825 } |
3826 | 3826 |
3827 encoded_string = make_unibyte_string (encoded, encoded_length); | 3827 encoded_string = make_unibyte_string (encoded, encoded_length); |
3828 SAFE_FREE (allength); | 3828 SAFE_FREE (); |
3829 | 3829 |
3830 return encoded_string; | 3830 return encoded_string; |
3831 } | 3831 } |
3832 | 3832 |
3833 static int | 3833 static int |
3960 abort (); | 3960 abort (); |
3961 | 3961 |
3962 if (decoded_length < 0) | 3962 if (decoded_length < 0) |
3963 { | 3963 { |
3964 /* The decoding wasn't possible. */ | 3964 /* The decoding wasn't possible. */ |
3965 SAFE_FREE (allength); | 3965 SAFE_FREE (); |
3966 error ("Invalid base64 data"); | 3966 error ("Invalid base64 data"); |
3967 } | 3967 } |
3968 | 3968 |
3969 /* Now we have decoded the region, so we insert the new contents | 3969 /* Now we have decoded the region, so we insert the new contents |
3970 and delete the old. (Insert first in order to preserve markers.) */ | 3970 and delete the old. (Insert first in order to preserve markers.) */ |
3971 TEMP_SET_PT_BOTH (XFASTINT (beg), ibeg); | 3971 TEMP_SET_PT_BOTH (XFASTINT (beg), ibeg); |
3972 insert_1_both (decoded, inserted_chars, decoded_length, 0, 1, 0); | 3972 insert_1_both (decoded, inserted_chars, decoded_length, 0, 1, 0); |
3973 SAFE_FREE (allength); | 3973 SAFE_FREE (); |
3974 | 3974 |
3975 /* Delete the original text. */ | 3975 /* Delete the original text. */ |
3976 del_range_both (PT, PT_BYTE, XFASTINT (end) + inserted_chars, | 3976 del_range_both (PT, PT_BYTE, XFASTINT (end) + inserted_chars, |
3977 iend + decoded_length, 1); | 3977 iend + decoded_length, 1); |
3978 | 3978 |
4012 else if (decoded_length >= 0) | 4012 else if (decoded_length >= 0) |
4013 decoded_string = make_unibyte_string (decoded, decoded_length); | 4013 decoded_string = make_unibyte_string (decoded, decoded_length); |
4014 else | 4014 else |
4015 decoded_string = Qnil; | 4015 decoded_string = Qnil; |
4016 | 4016 |
4017 SAFE_FREE (length); | 4017 SAFE_FREE (); |
4018 if (!STRINGP (decoded_string)) | 4018 if (!STRINGP (decoded_string)) |
4019 error ("Invalid base64 data"); | 4019 error ("Invalid base64 data"); |
4020 | 4020 |
4021 return decoded_string; | 4021 return decoded_string; |
4022 } | 4022 } |