comparison src/alloc.c @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents 376386a54a3c
children 0293115a14e9
comparison
equal deleted inserted replaced
13:13c6d0aaafe5 14:9ee227acff29
2086 int len = set_charptr_emchar (str, XCHAR (init)); 2086 int len = set_charptr_emchar (str, XCHAR (init));
2087 2087
2088 val = make_uninit_string (len * XINT (length)); 2088 val = make_uninit_string (len * XINT (length));
2089 if (len == 1) 2089 if (len == 1)
2090 /* Optimize the single-byte case */ 2090 /* Optimize the single-byte case */
2091 memset (string_data (XSTRING (val)), XCHAR (init), 2091 memset (XSTRING_DATA (val), XCHAR (init), XSTRING_LENGTH (val));
2092 string_length (XSTRING (val)));
2093 else 2092 else
2094 { 2093 {
2095 int i, j, k; 2094 int i, j, k;
2096 Bufbyte *ptr = string_data (XSTRING (val)); 2095 Bufbyte *ptr = XSTRING_DATA (val);
2097 2096
2098 k = 0; 2097 k = 0;
2099 for (i = 0; i < XINT (length); i++) 2098 for (i = 0; i < XINT (length); i++)
2100 for (j = 0; j < len; j++) 2099 for (j = 0; j < len; j++)
2101 ptr[k++] = str[j]; 2100 ptr[k++] = str[j];
2110 make_string (CONST Bufbyte *contents, Bytecount length) 2109 make_string (CONST Bufbyte *contents, Bytecount length)
2111 { 2110 {
2112 Lisp_Object val; 2111 Lisp_Object val;
2113 2112
2114 val = make_uninit_string (length); 2113 val = make_uninit_string (length);
2115 memcpy (string_data (XSTRING (val)), contents, length); 2114 memcpy (XSTRING_DATA (val), contents, length);
2116 return (val); 2115 return (val);
2117 } 2116 }
2118 2117
2119 /* Take some raw memory, encoded in some external data format, 2118 /* Take some raw memory, encoded in some external data format,
2120 and convert it into a Lisp string. */ 2119 and convert it into a Lisp string. */
2210 while (!NILP (chain)) 2209 while (!NILP (chain))
2211 { 2210 {
2212 struct lrecord_header *lheader = XRECORD_LHEADER (chain); 2211 struct lrecord_header *lheader = XRECORD_LHEADER (chain);
2213 struct free_lcrecord_header *free_header = 2212 struct free_lcrecord_header *free_header =
2214 (struct free_lcrecord_header *) lheader; 2213 (struct free_lcrecord_header *) lheader;
2214
2215 #ifdef ERROR_CHECK_GC
2215 CONST struct lrecord_implementation *implementation 2216 CONST struct lrecord_implementation *implementation
2216 = lheader->implementation; 2217 = lheader->implementation;
2217 2218
2218 #ifdef ERROR_CHECK_GC
2219 /* There should be no other pointers to the free list. */ 2219 /* There should be no other pointers to the free list. */
2220 assert (!MARKED_RECORD_HEADER_P (lheader)); 2220 assert (!MARKED_RECORD_HEADER_P (lheader));
2221 /* Only lcrecords should be here. */ 2221 /* Only lcrecords should be here. */
2222 assert (!implementation->basic_p); 2222 assert (!implementation->basic_p);
2223 /* Only free lcrecords should be here. */ 2223 /* Only free lcrecords should be here. */
2225 /* The type of the lcrecord must be right. */ 2225 /* The type of the lcrecord must be right. */
2226 assert (implementation == list->implementation); 2226 assert (implementation == list->implementation);
2227 /* So must the size. */ 2227 /* So must the size. */
2228 assert (implementation->static_size == 0 2228 assert (implementation->static_size == 0
2229 || implementation->static_size == list->size); 2229 || implementation->static_size == list->size);
2230 #endif 2230 #endif /* ERROR_CHECK_GC */
2231
2231 MARK_RECORD_HEADER (lheader); 2232 MARK_RECORD_HEADER (lheader);
2232 chain = free_header->chain; 2233 chain = free_header->chain;
2233 } 2234 }
2234 2235
2235 return Qnil; 2236 return Qnil;
3902 3903
3903 /* Don't print messages to the stream device. */ 3904 /* Don't print messages to the stream device. */
3904 if (!cursor_changed && !FRAME_STREAM_P (f)) 3905 if (!cursor_changed && !FRAME_STREAM_P (f))
3905 { 3906 {
3906 char *msg = (STRINGP (Vgc_message) 3907 char *msg = (STRINGP (Vgc_message)
3907 ? GETTEXT ((char *) string_data (XSTRING (Vgc_message))) 3908 ? GETTEXT ((char *) XSTRING_DATA (Vgc_message))
3908 : 0); 3909 : 0);
3909 Lisp_Object args[2], whole_msg; 3910 Lisp_Object args[2], whole_msg;
3910 args[0] = build_string (msg ? msg : 3911 args[0] = build_string (msg ? msg :
3911 GETTEXT ((CONST char *) gc_default_message)); 3912 GETTEXT ((CONST char *) gc_default_message));
3912 args[1] = build_string ("..."); 3913 args[1] = build_string ("...");
4049 if (cursor_changed) 4050 if (cursor_changed)
4050 Fset_frame_pointer (make_frame (f), pre_gc_cursor); 4051 Fset_frame_pointer (make_frame (f), pre_gc_cursor);
4051 else if (!FRAME_STREAM_P (f)) 4052 else if (!FRAME_STREAM_P (f))
4052 { 4053 {
4053 char *msg = (STRINGP (Vgc_message) 4054 char *msg = (STRINGP (Vgc_message)
4054 ? GETTEXT ((char *) string_data (XSTRING (Vgc_message))) 4055 ? GETTEXT ((char *) XSTRING_DATA (Vgc_message))
4055 : 0); 4056 : 0);
4056 4057
4057 /* Show "...done" only if the echo area would otherwise be empty. */ 4058 /* Show "...done" only if the echo area would otherwise be empty. */
4058 if (NILP (clear_echo_area (selected_frame (), 4059 if (NILP (clear_echo_area (selected_frame (),
4059 Qgarbage_collecting, 0))) 4060 Qgarbage_collecting, 0)))