ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/misc.C
(Generate patch)

Comparing rxvt-unicode/src/misc.C (file contents):
Revision 1.49 by ayin, Wed Oct 31 09:55:23 2007 UTC vs.
Revision 1.52 by root, Sat Apr 26 03:37:18 2008 UTC

38 while (len--) 38 while (len--)
39 { 39 {
40 ssize_t l = wcrtomb (dst, *str++, mbs); 40 ssize_t l = wcrtomb (dst, *str++, mbs);
41 41
42 if (l < 0) 42 if (l < 0)
43 {
43 *dst++ = '?'; 44 *dst++ = '?';
45 wcrtomb (0, 0, mbs); // reset undefined state
46 }
44 else 47 else
45 dst += l; 48 dst += l;
46 } 49 }
47 50
48 *dst++ = 0; 51 *dst++ = 0;
285 for (l = 0, t = s; l < n; l++) 288 for (l = 0, t = s; l < n; l++)
286 { 289 {
287 for ( ; *t && *t != ','; t++) ; 290 for ( ; *t && *t != ','; t++) ;
288 p = t - s; 291 p = t - s;
289 ret[l] = (char *)malloc (p + 1); 292 ret[l] = (char *)malloc (p + 1);
290 strncpy (ret[l], s, p); 293 memcpy (ret[l], s, p);
291 ret[l][p] = '\0'; 294 ret[l][p] = '\0';
292 rxvt_strtrim (ret[l]); 295 rxvt_strtrim (ret[l]);
293 s = ++t; 296 s = ++t;
294 } 297 }
295 298
303 free (cs[i]); 306 free (cs[i]);
304 307
305 free (cs); 308 free (cs);
306} 309}
307 310
311void *
312rxvt_malloc (size_t size)
313{
314 void *p = malloc (size);
308 315
316 if (!p)
317 rxvt_fatal ("memory allocation failure. aborting.\n");
309 318
319 return p;
320}
321
322void *
323rxvt_calloc (size_t number, size_t size)
324{
325 void *p = calloc (number, size);
326
327 if (!p)
328 rxvt_fatal ("memory allocation failure. aborting.\n");
329
330 return p;
331}
332
333void *
334rxvt_realloc (void *ptr, size_t size)
335{
336 void *p = realloc (ptr, size);
337
338 if (!p)
339 rxvt_fatal ("memory allocation failure. aborting.\n");
340
341 return p;
342}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines