comparison lphobos/std/outbuffer.d @ 662:88e23f8c2354

Applied downs' latest Phobos patch
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 06 Oct 2008 21:40:33 +0200
parents 373489eeaf90
children
comparison
equal deleted inserted replaced
661:99f32e967746 662:88e23f8c2354
266 { 266 {
267 count = _vsnprintf(p,psize,f,args_copy); 267 count = _vsnprintf(p,psize,f,args_copy);
268 if (count != -1) 268 if (count != -1)
269 break; 269 break;
270 psize *= 2; 270 psize *= 2;
271 p = cast(char *) alloca(psize); // buffer too small, try again with larger size 271 p = cast(char *) /*alloca*/malloc(psize); // buffer too small, try again with larger size
272 } 272 }
273 else version(GNU) { 273 else version(GNU) {
274 count = vsnprintf(p,psize,f,args_copy); 274 count = vsnprintf(p,psize,f,args_copy);
275 if (count == -1) 275 if (count == -1)
276 psize *= 2; 276 psize *= 2;
277 else if (count >= psize) 277 else if (count >= psize)
278 psize = count + 1; 278 psize = count + 1;
279 else 279 else
280 break; 280 break;
281 p = cast(char *) alloca(psize); // buffer too small, try again with larger size 281 p = cast(char *) /*alloca*/std.gc.malloc(psize); // buffer too small, try again with larger size
282 } 282 }
283 else version(linux) 283 else version(linux)
284 { 284 {
285 count = vsnprintf(p,psize,f,args_copy); 285 count = vsnprintf(p,psize,f,args_copy);
286 if (count == -1) 286 if (count == -1)
292 /+ 292 /+
293 if (p != buffer) 293 if (p != buffer)
294 c.stdlib.free(p); 294 c.stdlib.free(p);
295 p = (char *) c.stdlib.malloc(psize); // buffer too small, try again with larger size 295 p = (char *) c.stdlib.malloc(psize); // buffer too small, try again with larger size
296 +/ 296 +/
297 p = cast(char *) alloca(psize); // buffer too small, try again with larger size 297 p = cast(char *) /*alloca*/std.gc.malloc(psize); // buffer too small, try again with larger size
298 } 298 }
299 } 299 }
300 write(p[0 .. count]); 300 write(p[0 .. count]);
301 /+ 301 /+
302 version (linux) 302 version (linux)