From 1d3e262e402f90a96530ab33ad5eaf3582c9e67e Mon Sep 17 00:00:00 2001 From: jilles Date: Wed, 2 May 2007 12:56:40 -0700 Subject: [PATCH] [svn] Remove emptyline craq because it leaks memory on /rehash motd etc. from ratbox 2.2 (anfl/Androsyn) --- ChangeLog | 13 +++++++++++++ include/serno.h | 2 +- src/cache.c | 22 +++++++--------------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index f268389f..a3b76dbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +jilles 2007/04/28 23:47:25 UTC (20070428-3434) + Log: + Merge old trunk r2767: + Copy channel name from command on lowerTS JOIN/SJOIN, + this makes the capitalization of the channel name + timestamped like modes are. + + + Changes: Modified: + +3 -0 trunk/modules/core/m_join.c (File Modified) + +3 -0 trunk/modules/core/m_sjoin.c (File Modified) + + jilles 2007/04/26 23:01:16 UTC (20070426-3432) Log: Merge old trunk r2065,r2067: diff --git a/include/serno.h b/include/serno.h index c17ce25a..e0ca67a6 100644 --- a/include/serno.h +++ b/include/serno.h @@ -1 +1 @@ -#define SERNO "20070426-3432" +#define SERNO "20070428-3434" diff --git a/src/cache.c b/src/cache.c index d8ac748e..0a23ebbc 100644 --- a/src/cache.c +++ b/src/cache.c @@ -29,7 +29,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $Id: cache.c 254 2005-09-21 23:35:12Z nenolod $ + * $Id: cache.c 3436 2007-05-02 19:56:40Z jilles $ */ #include "stdinc.h" @@ -50,7 +50,6 @@ static BlockHeap *cacheline_heap = NULL; struct cachefile *user_motd = NULL; struct cachefile *oper_motd = NULL; -struct cacheline *emptyline = NULL; dlink_list links_cache_list; char user_motd_changed[MAX_DATE_STRING]; @@ -66,10 +65,6 @@ init_cache(void) cachefile_heap = BlockHeapCreate(sizeof(struct cachefile), CACHEFILE_HEAP_SIZE); cacheline_heap = BlockHeapCreate(sizeof(struct cacheline), CACHELINE_HEAP_SIZE); - /* allocate the emptyline */ - emptyline = BlockHeapAlloc(cacheline_heap); - emptyline->data[0] = ' '; - emptyline->data[1] = '\0'; user_motd_changed[0] = '\0'; user_motd = cache_file(MPATH, "ircd.motd", 0); @@ -124,14 +119,12 @@ cache_file(const char *filename, const char *shortname, int flags) if((p = strchr(line, '\n')) != NULL) *p = '\0'; - if(!EmptyString(line)) - { - lineptr = BlockHeapAlloc(cacheline_heap); - strlcpy(lineptr->data, line, sizeof(lineptr->data)); - dlinkAddTail(lineptr, &lineptr->linenode, &cacheptr->contents); - } + lineptr = BlockHeapAlloc(cacheline_heap); + if(EmptyString(line)) + strlcpy(lineptr->data, " ", sizeof(lineptr->data)); else - dlinkAddTailAlloc(emptyline, &cacheptr->contents); + strlcpy(lineptr->data, line, sizeof(lineptr->data)); + dlinkAddTail(lineptr, &lineptr->linenode, &cacheptr->contents); } fclose(in); @@ -192,8 +185,7 @@ free_cachefile(struct cachefile *cacheptr) DLINK_FOREACH_SAFE(ptr, next_ptr, cacheptr->contents.head) { - if(ptr->data != emptyline) - BlockHeapFree(cacheline_heap, ptr->data); + BlockHeapFree(cacheline_heap, ptr->data); } BlockHeapFree(cachefile_heap, cacheptr);