Mercurial > emacs
comparison src/dired.c @ 21393:5f153464fc99
(Fdirectory_files): Use make_uninit_multibyte_string.
Use STRING_BYTES on encoded_directory.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 06 Apr 1998 21:52:29 +0000 |
parents | 28b9e0d48deb |
children | fa9ff387d260 |
comparison
equal
deleted
inserted
replaced
21392:20bc0bd34ada | 21393:5f153464fc99 |
---|---|
181 d = opendir (XSTRING (dirfilename)->data); | 181 d = opendir (XSTRING (dirfilename)->data); |
182 if (! d) | 182 if (! d) |
183 report_file_error ("Opening directory", Fcons (directory, Qnil)); | 183 report_file_error ("Opening directory", Fcons (directory, Qnil)); |
184 | 184 |
185 list = Qnil; | 185 list = Qnil; |
186 dirnamelen = XSTRING (encoded_directory)->size; | 186 dirnamelen = STRING_BYTES (XSTRING (encoded_directory)); |
187 re_match_object = Qt; | 187 re_match_object = Qt; |
188 | 188 |
189 /* Decide whether we need to add a directory separator. */ | 189 /* Decide whether we need to add a directory separator. */ |
190 #ifndef VMS | 190 #ifndef VMS |
191 if (dirnamelen == 0 | 191 if (dirnamelen == 0 |
192 || !IS_ANY_SEP (XSTRING (encoded_directory)->data[dirnamelen - 1])) | 192 || !IS_ANY_SEP (XSTRING (encoded_directory)->data[dirnamelen - 1])) |
193 needsep = 1; | 193 needsep = 1; |
194 #endif /* VMS */ | 194 #endif /* not VMS */ |
195 | 195 |
196 GCPRO2 (encoded_directory, list); | 196 GCPRO2 (encoded_directory, list); |
197 | 197 |
198 /* Loop reading blocks */ | 198 /* Loop reading blocks */ |
199 while (1) | 199 while (1) |
212 { | 212 { |
213 int afterdirindex = dirnamelen; | 213 int afterdirindex = dirnamelen; |
214 int total = len + dirnamelen; | 214 int total = len + dirnamelen; |
215 int nchars; | 215 int nchars; |
216 | 216 |
217 name = make_uninit_string (total + needsep); | 217 name = make_uninit_multibyte_string (total + needsep, |
218 total + needsep); | |
218 bcopy (XSTRING (encoded_directory)->data, XSTRING (name)->data, | 219 bcopy (XSTRING (encoded_directory)->data, XSTRING (name)->data, |
219 dirnamelen); | 220 dirnamelen); |
220 if (needsep) | 221 if (needsep) |
221 XSTRING (name)->data[afterdirindex++] = DIRECTORY_SEP; | 222 XSTRING (name)->data[afterdirindex++] = DIRECTORY_SEP; |
222 bcopy (dp->d_name, | 223 bcopy (dp->d_name, |