Commit 315fe60c 315fe60c7cd20eae841370506e052abfaf700997 by Sergey Poznyakoff

(sieve_test_lookup,sieve_action_lookup)

(sieve_register_test,sieve_register_action): Accept the pointer
to sieve machine as first argument.
1 parent d8a33e76
...@@ -25,9 +25,6 @@ ...@@ -25,9 +25,6 @@
25 #include <string.h> 25 #include <string.h>
26 #include <sieve.h> 26 #include <sieve.h>
27 27
28 static list_t test_list;
29 static list_t action_list;
30
31 static sieve_register_t * 28 static sieve_register_t *
32 sieve_lookup (list_t list, const char *name) 29 sieve_lookup (list_t list, const char *name)
33 { 30 {
...@@ -50,24 +47,25 @@ sieve_lookup (list_t list, const char *name) ...@@ -50,24 +47,25 @@ sieve_lookup (list_t list, const char *name)
50 } 47 }
51 48
52 sieve_register_t * 49 sieve_register_t *
53 sieve_test_lookup (const char *name) 50 sieve_test_lookup (sieve_machine_t mach, const char *name)
54 { 51 {
55 return sieve_lookup (test_list, name); 52 return sieve_lookup (mach->test_list, name);
56 } 53 }
57 54
58 sieve_register_t * 55 sieve_register_t *
59 sieve_action_lookup (const char *name) 56 sieve_action_lookup (sieve_machine_t mach, const char *name)
60 { 57 {
61 return sieve_lookup (action_list, name); 58 return sieve_lookup (mach->action_list, name);
62 } 59 }
63 60
64 static int 61 static int
65 sieve_register (list_t *list, 62 sieve_register (list_t *pool,
63 list_t *list,
66 const char *name, sieve_handler_t handler, 64 const char *name, sieve_handler_t handler,
67 sieve_data_type *arg_types, 65 sieve_data_type *arg_types,
68 sieve_tag_group_t *tags, int required) 66 sieve_tag_group_t *tags, int required)
69 { 67 {
70 sieve_register_t *reg = malloc (sizeof (*reg)); 68 sieve_register_t *reg = sieve_palloc (pool, sizeof (*reg));
71 69
72 if (!reg) 70 if (!reg)
73 return ENOMEM; 71 return ENOMEM;
...@@ -93,17 +91,23 @@ sieve_register (list_t *list, ...@@ -93,17 +91,23 @@ sieve_register (list_t *list,
93 91
94 92
95 int 93 int
96 sieve_register_test (const char *name, sieve_handler_t handler, 94 sieve_register_test (sieve_machine_t mach,
95 const char *name, sieve_handler_t handler,
97 sieve_data_type *arg_types, 96 sieve_data_type *arg_types,
98 sieve_tag_group_t *tags, int required) 97 sieve_tag_group_t *tags, int required)
99 { 98 {
100 return sieve_register (&test_list, name, handler, arg_types, tags, required); 99 return sieve_register (&mach->memory_pool,
100 &mach->test_list, name, handler,
101 arg_types, tags, required);
101 } 102 }
102 103
103 int 104 int
104 sieve_register_action (const char *name, sieve_handler_t handler, 105 sieve_register_action (sieve_machine_t mach,
106 const char *name, sieve_handler_t handler,
105 sieve_data_type *arg_types, 107 sieve_data_type *arg_types,
106 sieve_tag_group_t *tags, int required) 108 sieve_tag_group_t *tags, int required)
107 { 109 {
108 return sieve_register (&action_list, name, handler, arg_types, tags, required); 110 return sieve_register (&mach->memory_pool,
111 &mach->action_list, name, handler,
112 arg_types, tags, required);
109 } 113 }
......