comparison src/message.c @ 366:41958685480d

Switched to `type *name' style Andrew Koenig's ``C Traps and Pitfalls'' (Ch.2.1) convinced me that it is best to go with the way C had been designed. The ``declaration reflects use'' concept conflicts with a ``type* name'' notation. Hence I switched.
author markus schnalke <meillo@marmaro.de>
date Thu, 22 Sep 2011 15:07:40 +0200
parents 4c046561582a
children b27f66555ba8
comparison
equal deleted inserted replaced
365:934a223e4ee8 366:41958685480d
44 l_cnt (line count) covers '\r' characters which are not present in 44 l_cnt (line count) covers '\r' characters which are not present in
45 masqmail's internal format. Dots are also not stuffed in the 45 masqmail's internal format. Dots are also not stuffed in the
46 internal format. Dot-stuffing is ignored in the size. 46 internal format. Dot-stuffing is ignored in the size.
47 */ 47 */
48 gint 48 gint
49 msg_calc_size(message * msg, gboolean is_smtp) 49 msg_calc_size(message *msg, gboolean is_smtp)
50 { 50 {
51 GList *node; 51 GList *node;
52 gint l_cnt = 0; /* line count (we need to add so many '\r' for SMTP) */ 52 gint l_cnt = 0; /* line count (we need to add so many '\r' for SMTP) */
53 gint c_cnt = 0; /* character count */ 53 gint c_cnt = 0; /* character count */
54 54
89 89
90 return is_smtp ? c_cnt + l_cnt : c_cnt; 90 return is_smtp ? c_cnt + l_cnt : c_cnt;
91 } 91 }
92 92
93 void 93 void
94 msg_free_data(message * msg) 94 msg_free_data(message *msg)
95 { 95 {
96 GList *node; 96 GList *node;
97 97
98 if (msg->data_list) { 98 if (msg->data_list) {
99 for (node = g_list_first(msg->data_list); node; node = g_list_next(node)) { 99 for (node = g_list_first(msg->data_list); node; node = g_list_next(node)) {
104 msg->data_list = NULL; 104 msg->data_list = NULL;
105 } 105 }
106 } 106 }
107 107
108 void 108 void
109 destroy_message(message * msg) 109 destroy_message(message *msg)
110 { 110 {
111 GList *node; 111 GList *node;
112 112
113 if (!msg) { 113 if (!msg) {
114 return; 114 return;
147 147
148 g_free(msg); 148 g_free(msg);
149 } 149 }
150 150
151 void 151 void
152 destroy_msg_list(GList * msg_list) 152 destroy_msg_list(GList *msg_list)
153 { 153 {
154 GList *msg_node; 154 GList *msg_node;
155 155
156 foreach(msg_list, msg_node) { 156 foreach(msg_list, msg_node) {
157 message *msg = (message *) (msg_node->data); 157 message *msg = (message *) (msg_node->data);
159 } 159 }
160 g_list_free(msg_list); 160 g_list_free(msg_list);
161 } 161 }
162 162
163 msg_out* 163 msg_out*
164 create_msg_out(message * msg) 164 create_msg_out(message *msg)
165 { 165 {
166 msg_out *msgout = g_malloc0(sizeof(msg_out)); 166 msg_out *msgout = g_malloc0(sizeof(msg_out));
167 msgout->msg = msg; 167 msgout->msg = msg;
168 return msgout; 168 return msgout;
169 } 169 }
170 170
171 msg_out* 171 msg_out*
172 clone_msg_out(msg_out * msgout_orig) 172 clone_msg_out(msg_out *msgout_orig)
173 { 173 {
174 if (msgout_orig) { 174 if (msgout_orig) {
175 msg_out *msgout = create_msg_out(msgout_orig->msg); 175 msg_out *msgout = create_msg_out(msgout_orig->msg);
176 if (msgout) { 176 if (msgout) {
177 msgout->msg = msgout_orig->msg; 177 msgout->msg = msgout_orig->msg;
190 } 190 }
191 return NULL; 191 return NULL;
192 } 192 }
193 193
194 void 194 void
195 destroy_msg_out(msg_out * msgout) 195 destroy_msg_out(msg_out *msgout)
196 { 196 {
197 if (msgout) { 197 if (msgout) {
198 if (msgout->return_path) 198 if (msgout->return_path)
199 destroy_address(msgout->return_path); 199 destroy_address(msgout->return_path);
200 if (msgout->hdr_list) 200 if (msgout->hdr_list)
210 g_free(msgout); 210 g_free(msgout);
211 } 211 }
212 } 212 }
213 213
214 void 214 void
215 destroy_msg_out_list(GList * msgout_list) 215 destroy_msg_out_list(GList *msgout_list)
216 { 216 {
217 GList *msgout_node; 217 GList *msgout_node;
218 218
219 foreach(msgout_list, msgout_node) { 219 foreach(msgout_list, msgout_node) {
220 msg_out *msgout = (msg_out *) (msgout_node->data); 220 msg_out *msgout = (msg_out *) (msgout_node->data);