--- rxvt-unicode/src/salloc.C 2004/04/08 20:31:45 1.6 +++ rxvt-unicode/src/salloc.C 2006/02/20 22:40:35 1.9 @@ -3,7 +3,7 @@ *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. - * Copyright (c) 2003-2004 Marc Lehmann + * Copyright (c) 2003-2006 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,9 +70,28 @@ return r; } +void * +rxvt_salloc::alloc (void *data, unsigned int datalen) +{ + void *s = alloc (); + + if (datalen < size) + { + memcpy (s, data, datalen); + memset ((unsigned char *)s + datalen, 0, size - datalen); // not strictly required for screen.C + } + else + memcpy (s, data, size); + + return s; +} + void rxvt_salloc::free (void *data) { + if (!data) + return; + chain *line = (chain *)data; line->next = firstline; firstline = line;