diff options
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 24 |
1 files changed, 10 insertions, 14 deletions
| @@ -1992,17 +1992,14 @@ sort_vector (Lisp_Object vector, Lisp_Object predicate) | |||
| 1992 | return; | 1992 | return; |
| 1993 | ptrdiff_t halflen = len >> 1; | 1993 | ptrdiff_t halflen = len >> 1; |
| 1994 | Lisp_Object *tmp; | 1994 | Lisp_Object *tmp; |
| 1995 | Lisp_Object tmpvec = Qnil; | 1995 | struct gcpro gcpro1, gcpro2; |
| 1996 | struct gcpro gcpro1, gcpro2, gcpro3; | 1996 | GCPRO2 (vector, predicate); |
| 1997 | GCPRO3 (vector, predicate, tmpvec); | 1997 | USE_SAFE_ALLOCA; |
| 1998 | if (halflen < MAX_ALLOCA / word_size) | 1998 | SAFE_ALLOCA_LISP (tmp, halflen); |
| 1999 | tmp = alloca (halflen * word_size); | 1999 | for (ptrdiff_t i = 0; i < halflen; i++) |
| 2000 | else | 2000 | tmp[i] = make_number (0); |
| 2001 | { | ||
| 2002 | tmpvec = Fmake_vector (make_number (halflen), make_number (0)); | ||
| 2003 | tmp = XVECTOR (tmpvec)->contents; | ||
| 2004 | } | ||
| 2005 | sort_vector_inplace (predicate, len, XVECTOR (vector)->contents, tmp); | 2001 | sort_vector_inplace (predicate, len, XVECTOR (vector)->contents, tmp); |
| 2002 | SAFE_FREE (); | ||
| 2006 | UNGCPRO; | 2003 | UNGCPRO; |
| 2007 | } | 2004 | } |
| 2008 | 2005 | ||
| @@ -3289,7 +3286,6 @@ into shorter lines. */) | |||
| 3289 | if (encoded_length < 0) | 3286 | if (encoded_length < 0) |
| 3290 | { | 3287 | { |
| 3291 | /* The encoding wasn't possible. */ | 3288 | /* The encoding wasn't possible. */ |
| 3292 | SAFE_FREE (); | ||
| 3293 | error ("Multibyte character in data for base64 encoding"); | 3289 | error ("Multibyte character in data for base64 encoding"); |
| 3294 | } | 3290 | } |
| 3295 | 3291 | ||
| @@ -3434,7 +3430,6 @@ If the region can't be decoded, signal an error and don't modify the buffer. */ | |||
| 3434 | if (decoded_length < 0) | 3430 | if (decoded_length < 0) |
| 3435 | { | 3431 | { |
| 3436 | /* The decoding wasn't possible. */ | 3432 | /* The decoding wasn't possible. */ |
| 3437 | SAFE_FREE (); | ||
| 3438 | error ("Invalid base64 data"); | 3433 | error ("Invalid base64 data"); |
| 3439 | } | 3434 | } |
| 3440 | 3435 | ||
| @@ -4581,12 +4576,12 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) | |||
| 4581 | { | 4576 | { |
| 4582 | Lisp_Object test, size, rehash_size, rehash_threshold, weak; | 4577 | Lisp_Object test, size, rehash_size, rehash_threshold, weak; |
| 4583 | struct hash_table_test testdesc; | 4578 | struct hash_table_test testdesc; |
| 4584 | char *used; | ||
| 4585 | ptrdiff_t i; | 4579 | ptrdiff_t i; |
| 4580 | USE_SAFE_ALLOCA; | ||
| 4586 | 4581 | ||
| 4587 | /* The vector `used' is used to keep track of arguments that | 4582 | /* The vector `used' is used to keep track of arguments that |
| 4588 | have been consumed. */ | 4583 | have been consumed. */ |
| 4589 | used = alloca (nargs * sizeof *used); | 4584 | char *used = SAFE_ALLOCA (nargs * sizeof *used); |
| 4590 | memset (used, 0, nargs * sizeof *used); | 4585 | memset (used, 0, nargs * sizeof *used); |
| 4591 | 4586 | ||
| 4592 | /* See if there's a `:test TEST' among the arguments. */ | 4587 | /* See if there's a `:test TEST' among the arguments. */ |
| @@ -4653,6 +4648,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) | |||
| 4653 | if (!used[i]) | 4648 | if (!used[i]) |
| 4654 | signal_error ("Invalid argument list", args[i]); | 4649 | signal_error ("Invalid argument list", args[i]); |
| 4655 | 4650 | ||
| 4651 | SAFE_FREE (); | ||
| 4656 | return make_hash_table (testdesc, size, rehash_size, rehash_threshold, weak); | 4652 | return make_hash_table (testdesc, size, rehash_size, rehash_threshold, weak); |
| 4657 | } | 4653 | } |
| 4658 | 4654 | ||