Mercurial > emacs
changeset 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 | c0675c413aa3 |
children | c3945be39e09 |
files | src/ChangeLog src/casefiddle.c src/charset.c src/data.c src/fns.c src/xdisp.c |
diffstat | 6 files changed, 28 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Tue Oct 26 22:37:34 2004 +0000 +++ b/src/ChangeLog Tue Oct 26 22:38:50 2004 +0000 @@ -1,3 +1,14 @@ +2004-10-27 Kim F. Storm <storm@cua.dk> + + * editfns.c (Fformat): Allocate discarded table with SAFE_ALLOCA. + Only allocate info and discarded tables once. + + * lisp.h (USE_SAFE_ALLOCA): Add and init sa_must_free integer. + (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Increment it when malloc is used. + (SAFE_FREE): Test it to determine if we need to unwind to free. + Remove size arg. All users changed. + (SAFE_FREE_LISP) Remove. All users changed to use SAFE_FREE. + 2004-10-26 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> * gtkutil.c: Put empty line between comment and function body.
--- a/src/casefiddle.c Tue Oct 26 22:37:34 2004 +0000 +++ b/src/casefiddle.c Tue Oct 26 22:38:50 2004 +0000 @@ -137,7 +137,7 @@ } obj = make_multibyte_string (buf, SCHARS (obj), j_byte); - SAFE_FREE (bufsize); + SAFE_FREE (); } return obj; }
--- a/src/charset.c Tue Oct 26 22:37:34 2004 +0000 +++ b/src/charset.c Tue Oct 26 22:38:50 2004 +0000 @@ -1673,7 +1673,7 @@ } ret = make_string_from_bytes (buf, n, p - buf); - SAFE_FREE (bufsize); + SAFE_FREE (); return ret; }
--- a/src/data.c Tue Oct 26 22:37:34 2004 +0000 +++ b/src/data.c Tue Oct 26 22:38:50 2004 +0000 @@ -2165,7 +2165,7 @@ p1 = SDATA (array) + idxval_byte; bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes, nbytes - (idxval_byte + prev_bytes)); - SAFE_FREE (nbytes); + SAFE_FREE (); clear_string_char_byte_cache (); } while (new_bytes--) @@ -2206,7 +2206,7 @@ *p1++ = *p0++; bcopy (str + idxval_byte + prev_bytes, p1, nbytes - (idxval_byte + prev_bytes)); - SAFE_FREE (nbytes); + SAFE_FREE (); clear_string_char_byte_cache (); } }
--- a/src/fns.c Tue Oct 26 22:37:34 2004 +0000 +++ b/src/fns.c Tue Oct 26 22:38:50 2004 +0000 @@ -1012,7 +1012,7 @@ 0, 1); ret = make_multibyte_string (buf, SCHARS (string), nbytes); - SAFE_FREE (nbytes); + SAFE_FREE (); return ret; } @@ -1046,7 +1046,7 @@ str_to_multibyte (buf, nbytes, SBYTES (string)); ret = make_multibyte_string (buf, SCHARS (string), nbytes); - SAFE_FREE (nbytes); + SAFE_FREE (); return ret; } @@ -1073,7 +1073,7 @@ 1, 0); ret = make_unibyte_string (buf, nchars); - SAFE_FREE (nchars); + SAFE_FREE (); return ret; } @@ -3030,7 +3030,7 @@ args[i] = separator; ret = Fconcat (nargs, args); - SAFE_FREE_LISP (nargs); + SAFE_FREE (); return ret; } @@ -3056,7 +3056,7 @@ mapcar1 (leni, args, function, sequence); ret = Flist (leni, args); - SAFE_FREE_LISP (leni); + SAFE_FREE (); return ret; } @@ -3763,7 +3763,7 @@ if (encoded_length < 0) { /* The encoding wasn't possible. */ - SAFE_FREE (allength); + SAFE_FREE (); error ("Multibyte character in data for base64 encoding"); } @@ -3771,7 +3771,7 @@ and delete the old. (Insert first in order to preserve markers.) */ SET_PT_BOTH (XFASTINT (beg), ibeg); insert (encoded, encoded_length); - SAFE_FREE (allength); + SAFE_FREE (); del_range_byte (ibeg + encoded_length, iend + encoded_length, 1); /* If point was outside of the region, restore it exactly; else just @@ -3820,12 +3820,12 @@ if (encoded_length < 0) { /* The encoding wasn't possible. */ - SAFE_FREE (allength); + SAFE_FREE (); error ("Multibyte character in data for base64 encoding"); } encoded_string = make_unibyte_string (encoded, encoded_length); - SAFE_FREE (allength); + SAFE_FREE (); return encoded_string; } @@ -3962,7 +3962,7 @@ if (decoded_length < 0) { /* The decoding wasn't possible. */ - SAFE_FREE (allength); + SAFE_FREE (); error ("Invalid base64 data"); } @@ -3970,7 +3970,7 @@ and delete the old. (Insert first in order to preserve markers.) */ TEMP_SET_PT_BOTH (XFASTINT (beg), ibeg); insert_1_both (decoded, inserted_chars, decoded_length, 0, 1, 0); - SAFE_FREE (allength); + SAFE_FREE (); /* Delete the original text. */ del_range_both (PT, PT_BYTE, XFASTINT (end) + inserted_chars, @@ -4014,7 +4014,7 @@ else decoded_string = Qnil; - SAFE_FREE (length); + SAFE_FREE (); if (!STRINGP (decoded_string)) error ("Invalid base64 data");