# HG changeset patch # User Juanma Barranquero # Date 1181332786 0 # Node ID 1842d7137ff298abae66dafcd9da9d4a8ead04bc # Parent 0aafd69cb5086219a94b1bae1370bb595c5cd066 (init_strings): Initialize canonical empty strings. (make_uninit_string, make_uninit_multibyte_string): Return appropriate canonical empty string when the requested size is 0. diff -r 0aafd69cb508 -r 1842d7137ff2 src/alloc.c --- a/src/alloc.c Fri Jun 08 19:58:33 2007 +0000 +++ b/src/alloc.c Fri Jun 08 19:59:46 2007 +0000 @@ -1756,6 +1756,8 @@ string_blocks = NULL; n_string_blocks = 0; string_free_list = NULL; + empty_unibyte_string = make_pure_string ("", 0, 0, 0); + empty_multibyte_string = make_pure_string ("", 0, 0, 1); } @@ -2479,6 +2481,9 @@ int length; { Lisp_Object val; + + if (!length) + return empty_unibyte_string; val = make_uninit_multibyte_string (length, length); STRING_SET_UNIBYTE (val); return val; @@ -2497,6 +2502,8 @@ if (nchars < 0) abort (); + if (!nbytes) + return empty_multibyte_string; s = allocate_string (); allocate_string_data (s, nchars, nbytes);