]> source.dussan.org Git - rspamd.git/commitdiff
Optimization.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 14 Mar 2011 18:29:35 +0000 (21:29 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 14 Mar 2011 18:29:35 +0000 (21:29 +0300)
src/lua/lua_task.c
src/mem_pool.c

index eb95f0258dc700d06c31b6736f22215b56e2adf6..f161eca5eaca41ad95a80da4735c3205e8b0ab86 100644 (file)
@@ -466,7 +466,7 @@ lua_dns_callback (struct rspamd_dns_reply *reply, gpointer arg)
                        cur = reply->elements;
                        while (cur) {
                                elt = cur->data;
-                               memcpy (&ina, elt->a.addr, sizeof (in_addr_t));
+                               memcpy (&ina, &elt->a.addr[0], sizeof (struct in_addr));
                                /* Actually this copy memory, so using of inet_ntoa is valid */
                                lua_pushstring (cd->L, inet_ntoa (ina));
                                lua_rawseti (cd->L, -2, ++i);
@@ -474,7 +474,7 @@ lua_dns_callback (struct rspamd_dns_reply *reply, gpointer arg)
                        }
                        lua_pushnil (cd->L);
                }
-               else if (reply->type == DNS_REQUEST_A) {
+               else if (reply->type == DNS_REQUEST_PTR) {
                        lua_newtable (cd->L);
                        cur = reply->elements;
                        while (cur) {
@@ -811,16 +811,9 @@ static gint
 lua_task_get_recipients_headers (lua_State *L)
 {
        struct worker_task             *task = lua_check_task (L);
-       InternetAddressList            *addrs;
 
        if (task) {
-               addrs = g_mime_message_get_all_recipients(task->message);
-               lua_push_internet_address (L, addrs);
-#ifndef        GMIME24
-               internet_address_list_destroy (addrs);
-#else
-               g_object_unref (addrs);
-#endif
+               lua_push_internet_address (L, task->rcpts);
                return 1;
        }
 
index 161da4f01969652a77f24a7a9009ca854d829c20..ac870d42b674e7a12576e7eea67bd21ac61bfdfe 100644 (file)
@@ -205,7 +205,7 @@ memory_pool_alloc (memory_pool_t * pool, gsize size)
                        }
                        else {
                                mem_pool_stat->oversized_chunks++;
-                               new = pool_chain_new (size + cur->len);
+                               new = pool_chain_new (size + pool->first_pool->len);
                        }
                        /* Attach new pool to chain */
                        cur->next = new;
@@ -231,7 +231,7 @@ memory_pool_alloc0 (memory_pool_t * pool, gsize size)
 {
        void                           *pointer = memory_pool_alloc (pool, size);
        if (pointer) {
-               bzero (pointer, size);
+               memset (pointer, 0, size);
        }
        return pointer;
 }
@@ -241,7 +241,7 @@ memory_pool_alloc0_shared (memory_pool_t * pool, gsize size)
 {
        void                           *pointer = memory_pool_alloc_shared (pool, size);
        if (pointer) {
-               bzero (pointer, size);
+               memset (pointer, 0, size);
        }
        return pointer;
 }
@@ -445,18 +445,6 @@ memory_pool_add_destructor_full (memory_pool_t * pool, pool_destruct_func func,
 
        cur = memory_pool_alloc (pool, sizeof (struct _pool_destructors));
        if (cur) {
-               /* Check whether we have identical destructor in pool */
-               tmp = pool->destructors;
-               while (tmp) {
-                       if (tmp->func == func && tmp->data == data) {
-                               /* Do not add identical destructors, they must be unique */
-                               msg_warn ("duplicate desctrutors detected: already have destructor from %s:%s and is trying to add from %s:%s",
-                                               tmp->function, tmp->loc, function, line);
-                               return;
-                       }
-                       tmp = tmp->prev;
-               }
-
                cur->func = func;
                cur->data = data;
                cur->function = function;