add support for Ayatana indicator to Notification plugin
[claws.git] / src / plugins / mailmbox / mailimf_types.c
blob31969c084ca96d15b27b5f4bcbd9bd0221e39d99
1 /*
2 * libEtPan! -- a mail stuff library
4 * Copyright (C) 2001, 2002 - DINH Viet Hoa
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the libEtPan! project nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
33 * $Id$
36 #include "config.h"
38 #include "mailimf_types.h"
39 #include "mmapstring.h"
40 #include <stdlib.h>
42 void mailimf_atom_free(char * atom)
44 free(atom);
47 void mailimf_dot_atom_free(char * dot_atom)
49 free(dot_atom);
52 void mailimf_dot_atom_text_free(char * dot_atom)
54 free(dot_atom);
57 void mailimf_quoted_string_free(char * quoted_string)
59 free(quoted_string);
62 void mailimf_word_free(char * word)
64 free(word);
67 void mailimf_phrase_free(char * phrase)
69 free(phrase);
72 void mailimf_unstructured_free(char * unstructured)
74 free(unstructured);
78 struct mailimf_date_time *
79 mailimf_date_time_new(int dt_day, int dt_month, int dt_year,
80 int dt_hour, int dt_min, int dt_sec, int dt_zone)
82 struct mailimf_date_time * date_time;
84 date_time = malloc(sizeof(* date_time));
85 if (date_time == NULL)
86 return NULL;
88 date_time->dt_day = dt_day;
89 date_time->dt_month = dt_month;
90 date_time->dt_year = dt_year;
91 date_time->dt_hour = dt_hour;
92 date_time->dt_min = dt_min;
93 date_time->dt_sec = dt_sec;
94 date_time->dt_zone = dt_zone;
96 return date_time;
100 void mailimf_date_time_free(struct mailimf_date_time * date_time)
102 free(date_time);
108 struct mailimf_address *
109 mailimf_address_new(int ad_type, struct mailimf_mailbox * ad_mailbox,
110 struct mailimf_group * ad_group)
112 struct mailimf_address * address;
114 address = malloc(sizeof(* address));
115 if (address == NULL)
116 return NULL;
118 address->ad_type = ad_type;
119 switch (ad_type) {
120 case MAILIMF_ADDRESS_MAILBOX:
121 address->ad_data.ad_mailbox = ad_mailbox;
122 break;
123 case MAILIMF_ADDRESS_GROUP:
124 address->ad_data.ad_group = ad_group;
125 break;
128 return address;
131 void mailimf_address_free(struct mailimf_address * address)
133 switch (address->ad_type) {
134 case MAILIMF_ADDRESS_MAILBOX:
135 mailimf_mailbox_free(address->ad_data.ad_mailbox);
136 break;
137 case MAILIMF_ADDRESS_GROUP:
138 mailimf_group_free(address->ad_data.ad_group);
140 free(address);
143 struct mailimf_mailbox *
144 mailimf_mailbox_new(char * mb_display_name, char * mb_addr_spec)
146 struct mailimf_mailbox * mb;
148 mb = malloc(sizeof(* mb));
149 if (mb == NULL)
150 return NULL;
152 mb->mb_display_name = mb_display_name;
153 mb->mb_addr_spec = mb_addr_spec;
155 return mb;
158 void mailimf_mailbox_free(struct mailimf_mailbox * mailbox)
160 if (mailbox->mb_display_name != NULL)
161 mailimf_display_name_free(mailbox->mb_display_name);
162 mailimf_addr_spec_free(mailbox->mb_addr_spec);
163 free(mailbox);
167 void mailimf_angle_addr_free(char * angle_addr)
169 free(angle_addr);
173 struct mailimf_group *
174 mailimf_group_new(char * grp_display_name,
175 struct mailimf_mailbox_list * grp_mb_list)
177 struct mailimf_group * group;
179 group = malloc(sizeof(* group));
180 if (group == NULL)
181 return NULL;
183 group->grp_display_name = grp_display_name;
184 group->grp_mb_list = grp_mb_list;
186 return group;
189 void mailimf_group_free(struct mailimf_group * group)
191 if (group->grp_mb_list)
192 mailimf_mailbox_list_free(group->grp_mb_list);
193 mailimf_display_name_free(group->grp_display_name);
194 free(group);
197 void mailimf_display_name_free(char * display_name)
199 mailimf_phrase_free(display_name);
203 struct mailimf_mailbox_list *
204 mailimf_mailbox_list_new(clist * mb_list)
206 struct mailimf_mailbox_list * mbl;
208 mbl = malloc(sizeof(* mbl));
209 if (mbl == NULL)
210 return NULL;
212 mbl->mb_list = mb_list;
214 return mbl;
217 void mailimf_mailbox_list_free(struct mailimf_mailbox_list * mb_list)
219 clist_foreach(mb_list->mb_list, (clist_func) mailimf_mailbox_free, NULL);
220 clist_free(mb_list->mb_list);
221 free(mb_list);
226 struct mailimf_address_list *
227 mailimf_address_list_new(clist * ad_list)
229 struct mailimf_address_list * addr_list;
231 addr_list = malloc(sizeof(* addr_list));
232 if (addr_list == NULL)
233 return NULL;
235 addr_list->ad_list = ad_list;
237 return addr_list;
240 void mailimf_address_list_free(struct mailimf_address_list * addr_list)
242 clist_foreach(addr_list->ad_list, (clist_func) mailimf_address_free, NULL);
243 clist_free(addr_list->ad_list);
244 free(addr_list);
248 void mailimf_addr_spec_free(char * addr_spec)
250 free(addr_spec);
253 void mailimf_local_part_free(char * local_part)
255 free(local_part);
258 void mailimf_domain_free(char * domain)
260 free(domain);
263 void mailimf_domain_literal_free(char * domain_literal)
265 free(domain_literal);
270 struct mailimf_message *
271 mailimf_message_new(struct mailimf_fields * msg_fields,
272 struct mailimf_body * msg_body)
274 struct mailimf_message * message;
276 message = malloc(sizeof(* message));
277 if (message == NULL)
278 return NULL;
280 message->msg_fields = msg_fields;
281 message->msg_body = msg_body;
283 return message;
286 void mailimf_message_free(struct mailimf_message * message)
288 mailimf_body_free(message->msg_body);
289 mailimf_fields_free(message->msg_fields);
290 free(message);
294 struct mailimf_body * mailimf_body_new(const char * bd_text, size_t bd_size)
296 struct mailimf_body * body;
298 body = malloc(sizeof(* body));
299 if (body == NULL)
300 return NULL;
301 body->bd_text = bd_text;
302 body->bd_size = bd_size;
304 return body;
307 void mailimf_body_free(struct mailimf_body * body)
309 free(body);
314 struct mailimf_field *
315 mailimf_field_new(int fld_type,
316 struct mailimf_return * fld_return_path,
317 struct mailimf_orig_date * fld_resent_date,
318 struct mailimf_from * fld_resent_from,
319 struct mailimf_sender * fld_resent_sender,
320 struct mailimf_to * fld_resent_to,
321 struct mailimf_cc * fld_resent_cc,
322 struct mailimf_bcc * fld_resent_bcc,
323 struct mailimf_message_id * fld_resent_msg_id,
324 struct mailimf_orig_date * fld_orig_date,
325 struct mailimf_from * fld_from,
326 struct mailimf_sender * fld_sender,
327 struct mailimf_reply_to * fld_reply_to,
328 struct mailimf_to * fld_to,
329 struct mailimf_cc * fld_cc,
330 struct mailimf_bcc * fld_bcc,
331 struct mailimf_message_id * fld_message_id,
332 struct mailimf_in_reply_to * fld_in_reply_to,
333 struct mailimf_references * fld_references,
334 struct mailimf_subject * fld_subject,
335 struct mailimf_comments * fld_comments,
336 struct mailimf_keywords * fld_keywords,
337 struct mailimf_optional_field * fld_optional_field)
339 struct mailimf_field * field;
341 field = malloc(sizeof(* field));
342 if (field == NULL)
343 return NULL;
345 field->fld_type = fld_type;
346 switch (fld_type) {
347 case MAILIMF_FIELD_RETURN_PATH:
348 field->fld_data.fld_return_path = fld_return_path;
349 break;
350 case MAILIMF_FIELD_RESENT_DATE:
351 field->fld_data.fld_resent_date = fld_resent_date;
352 break;
353 case MAILIMF_FIELD_RESENT_FROM:
354 field->fld_data.fld_resent_from = fld_resent_from;
355 break;
356 case MAILIMF_FIELD_RESENT_SENDER:
357 field->fld_data.fld_resent_sender = fld_resent_sender;
358 break;
359 case MAILIMF_FIELD_RESENT_TO:
360 field->fld_data.fld_resent_to = fld_resent_to;
361 break;
362 case MAILIMF_FIELD_RESENT_CC:
363 field->fld_data.fld_resent_cc = fld_resent_cc;
364 break;
365 case MAILIMF_FIELD_RESENT_BCC:
366 field->fld_data.fld_resent_bcc = fld_resent_bcc;
367 break;
368 case MAILIMF_FIELD_RESENT_MSG_ID:
369 field->fld_data.fld_resent_msg_id = fld_resent_msg_id;
370 break;
371 case MAILIMF_FIELD_ORIG_DATE:
372 field->fld_data.fld_orig_date = fld_orig_date;
373 break;
374 case MAILIMF_FIELD_FROM:
375 field->fld_data.fld_from = fld_from;
376 break;
377 case MAILIMF_FIELD_SENDER:
378 field->fld_data.fld_sender = fld_sender;
379 break;
380 case MAILIMF_FIELD_REPLY_TO:
381 field->fld_data.fld_reply_to = fld_reply_to;
382 break;
383 case MAILIMF_FIELD_TO:
384 field->fld_data.fld_to = fld_to;
385 break;
386 case MAILIMF_FIELD_CC:
387 field->fld_data.fld_cc = fld_cc;
388 break;
389 case MAILIMF_FIELD_BCC:
390 field->fld_data.fld_bcc = fld_bcc;
391 break;
392 case MAILIMF_FIELD_MESSAGE_ID:
393 field->fld_data.fld_message_id = fld_message_id;
394 break;
395 case MAILIMF_FIELD_IN_REPLY_TO:
396 field->fld_data.fld_in_reply_to = fld_in_reply_to;
397 break;
398 case MAILIMF_FIELD_REFERENCES:
399 field->fld_data.fld_references = fld_references;
400 break;
401 case MAILIMF_FIELD_SUBJECT:
402 field->fld_data.fld_subject = fld_subject;
403 break;
404 case MAILIMF_FIELD_COMMENTS:
405 field->fld_data.fld_comments = fld_comments;
406 break;
407 case MAILIMF_FIELD_KEYWORDS:
408 field->fld_data.fld_keywords = fld_keywords;
409 break;
410 case MAILIMF_FIELD_OPTIONAL_FIELD:
411 field->fld_data.fld_optional_field = fld_optional_field;
412 break;
415 return field;
418 void mailimf_field_free(struct mailimf_field * field)
420 switch (field->fld_type) {
421 case MAILIMF_FIELD_RETURN_PATH:
422 mailimf_return_free(field->fld_data.fld_return_path);
423 break;
424 case MAILIMF_FIELD_RESENT_DATE:
425 mailimf_orig_date_free(field->fld_data.fld_resent_date);
426 break;
427 case MAILIMF_FIELD_RESENT_FROM:
428 mailimf_from_free(field->fld_data.fld_resent_from);
429 break;
430 case MAILIMF_FIELD_RESENT_SENDER:
431 mailimf_sender_free(field->fld_data.fld_resent_sender);
432 break;
433 case MAILIMF_FIELD_RESENT_TO:
434 mailimf_to_free(field->fld_data.fld_resent_to);
435 break;
436 case MAILIMF_FIELD_RESENT_CC:
437 mailimf_cc_free(field->fld_data.fld_resent_cc);
438 break;
439 case MAILIMF_FIELD_RESENT_BCC:
440 mailimf_bcc_free(field->fld_data.fld_resent_bcc);
441 break;
442 case MAILIMF_FIELD_RESENT_MSG_ID:
443 mailimf_message_id_free(field->fld_data.fld_resent_msg_id);
444 break;
445 case MAILIMF_FIELD_ORIG_DATE:
446 mailimf_orig_date_free(field->fld_data.fld_orig_date);
447 break;
448 case MAILIMF_FIELD_FROM:
449 mailimf_from_free(field->fld_data.fld_from);
450 break;
451 case MAILIMF_FIELD_SENDER:
452 mailimf_sender_free(field->fld_data.fld_sender);
453 break;
454 case MAILIMF_FIELD_REPLY_TO:
455 mailimf_reply_to_free(field->fld_data.fld_reply_to);
456 break;
457 case MAILIMF_FIELD_TO:
458 mailimf_to_free(field->fld_data.fld_to);
459 break;
460 case MAILIMF_FIELD_CC:
461 mailimf_cc_free(field->fld_data.fld_cc);
462 break;
463 case MAILIMF_FIELD_BCC:
464 mailimf_bcc_free(field->fld_data.fld_bcc);
465 break;
466 case MAILIMF_FIELD_MESSAGE_ID:
467 mailimf_message_id_free(field->fld_data.fld_message_id);
468 break;
469 case MAILIMF_FIELD_IN_REPLY_TO:
470 mailimf_in_reply_to_free(field->fld_data.fld_in_reply_to);
471 break;
472 case MAILIMF_FIELD_REFERENCES:
473 mailimf_references_free(field->fld_data.fld_references);
474 break;
475 case MAILIMF_FIELD_SUBJECT:
476 mailimf_subject_free(field->fld_data.fld_subject);
477 break;
478 case MAILIMF_FIELD_COMMENTS:
479 mailimf_comments_free(field->fld_data.fld_comments);
480 break;
481 case MAILIMF_FIELD_KEYWORDS:
482 mailimf_keywords_free(field->fld_data.fld_keywords);
483 break;
484 case MAILIMF_FIELD_OPTIONAL_FIELD:
485 mailimf_optional_field_free(field->fld_data.fld_optional_field);
486 break;
489 free(field);
492 struct mailimf_fields * mailimf_fields_new(clist * fld_list)
494 struct mailimf_fields * fields;
496 fields = malloc(sizeof(* fields));
497 if (fields == NULL)
498 return NULL;
500 fields->fld_list = fld_list;
502 return fields;
505 void mailimf_fields_free(struct mailimf_fields * fields)
507 if (fields->fld_list != NULL) {
508 clist_foreach(fields->fld_list, (clist_func) mailimf_field_free, NULL);
509 clist_free(fields->fld_list);
511 free(fields);
515 struct mailimf_orig_date * mailimf_orig_date_new(struct mailimf_date_time *
516 dt_date_time)
518 struct mailimf_orig_date * orig_date;
520 orig_date = malloc(sizeof(* orig_date));
521 if (orig_date == NULL)
522 return NULL;
524 orig_date->dt_date_time = dt_date_time;
526 return orig_date;
529 void mailimf_orig_date_free(struct mailimf_orig_date * orig_date)
531 if (orig_date->dt_date_time != NULL)
532 mailimf_date_time_free(orig_date->dt_date_time);
533 free(orig_date);
536 struct mailimf_from *
537 mailimf_from_new(struct mailimf_mailbox_list * frm_mb_list)
539 struct mailimf_from * from;
541 from = malloc(sizeof(* from));
542 if (from == NULL)
543 return NULL;
545 from->frm_mb_list = frm_mb_list;
547 return from;
550 void mailimf_from_free(struct mailimf_from * from)
552 if (from->frm_mb_list != NULL)
553 mailimf_mailbox_list_free(from->frm_mb_list);
554 free(from);
557 struct mailimf_sender * mailimf_sender_new(struct mailimf_mailbox * snd_mb)
559 struct mailimf_sender * sender;
561 sender = malloc(sizeof(* sender));
562 if (sender == NULL)
563 return NULL;
565 sender->snd_mb = snd_mb;
567 return sender;
570 void mailimf_sender_free(struct mailimf_sender * sender)
572 if (sender->snd_mb != NULL)
573 mailimf_mailbox_free(sender->snd_mb);
574 free(sender);
577 struct mailimf_reply_to *
578 mailimf_reply_to_new(struct mailimf_address_list * rt_addr_list)
580 struct mailimf_reply_to * reply_to;
582 reply_to = malloc(sizeof(* reply_to));
583 if (reply_to == NULL)
584 return NULL;
586 reply_to->rt_addr_list = rt_addr_list;
588 return reply_to;
591 void mailimf_reply_to_free(struct mailimf_reply_to * reply_to)
593 if (reply_to->rt_addr_list != NULL)
594 mailimf_address_list_free(reply_to->rt_addr_list);
595 free(reply_to);
598 struct mailimf_to * mailimf_to_new(struct mailimf_address_list * to_addr_list)
600 struct mailimf_to * to;
602 to = malloc(sizeof(* to));
603 if (to == NULL)
604 return NULL;
606 to->to_addr_list = to_addr_list;
608 return to;
611 void mailimf_to_free(struct mailimf_to * to)
613 if (to->to_addr_list != NULL)
614 mailimf_address_list_free(to->to_addr_list);
615 free(to);
618 struct mailimf_cc * mailimf_cc_new(struct mailimf_address_list * cc_addr_list)
620 struct mailimf_cc * cc;
622 cc = malloc(sizeof(* cc));
623 if (cc == NULL)
624 return NULL;
626 cc->cc_addr_list = cc_addr_list;
628 return cc;
631 void mailimf_cc_free(struct mailimf_cc * cc)
633 if (cc->cc_addr_list != NULL)
634 mailimf_address_list_free(cc->cc_addr_list);
635 free(cc);
638 struct mailimf_bcc *
639 mailimf_bcc_new(struct mailimf_address_list * bcc_addr_list)
641 struct mailimf_bcc * bcc;
643 bcc = malloc(sizeof(* bcc));
644 if (bcc == NULL)
645 return NULL;
647 bcc->bcc_addr_list = bcc_addr_list;
649 return bcc;
652 void mailimf_bcc_free(struct mailimf_bcc * bcc)
654 if (bcc->bcc_addr_list != NULL)
655 mailimf_address_list_free(bcc->bcc_addr_list);
656 free(bcc);
659 struct mailimf_message_id * mailimf_message_id_new(char * mid_value)
661 struct mailimf_message_id * message_id;
663 message_id = malloc(sizeof(* message_id));
664 if (message_id == NULL)
665 return NULL;
667 message_id->mid_value = mid_value;
669 return message_id;
672 void mailimf_message_id_free(struct mailimf_message_id * message_id)
674 if (message_id->mid_value != NULL)
675 mailimf_msg_id_free(message_id->mid_value);
676 free(message_id);
679 struct mailimf_in_reply_to * mailimf_in_reply_to_new(clist * mid_list)
681 struct mailimf_in_reply_to * in_reply_to;
683 in_reply_to = malloc(sizeof(* in_reply_to));
684 if (in_reply_to == NULL)
685 return NULL;
687 in_reply_to->mid_list = mid_list;
689 return in_reply_to;
692 void mailimf_in_reply_to_free(struct mailimf_in_reply_to * in_reply_to)
694 clist_foreach(in_reply_to->mid_list,
695 (clist_func) mailimf_msg_id_free, NULL);
696 clist_free(in_reply_to->mid_list);
697 free(in_reply_to);
700 struct mailimf_references * mailimf_references_new(clist * mid_list)
702 struct mailimf_references * ref;
704 ref = malloc(sizeof(* ref));
705 if (ref == NULL)
706 return NULL;
708 ref->mid_list = mid_list;
710 return ref;
713 void mailimf_references_free(struct mailimf_references * references)
715 clist_foreach(references->mid_list,
716 (clist_func) mailimf_msg_id_free, NULL);
717 clist_free(references->mid_list);
718 free(references);
721 void mailimf_msg_id_free(char * msg_id)
723 free(msg_id);
726 void mailimf_id_left_free(char * id_left)
728 free(id_left);
731 void mailimf_id_right_free(char * id_right)
733 free(id_right);
736 void mailimf_no_fold_quote_free(char * nfq)
738 free(nfq);
741 void mailimf_no_fold_literal_free(char * nfl)
743 free(nfl);
746 struct mailimf_subject * mailimf_subject_new(char * sbj_value)
748 struct mailimf_subject * subject;
750 subject = malloc(sizeof(* subject));
751 if (subject == NULL)
752 return NULL;
754 subject->sbj_value = sbj_value;
756 return subject;
759 void mailimf_subject_free(struct mailimf_subject * subject)
761 mailimf_unstructured_free(subject->sbj_value);
762 free(subject);
765 struct mailimf_comments * mailimf_comments_new(char * cm_value)
767 struct mailimf_comments * comments;
769 comments = malloc(sizeof(* comments));
770 if (comments == NULL)
771 return NULL;
773 comments->cm_value = cm_value;
775 return comments;
778 void mailimf_comments_free(struct mailimf_comments * comments)
780 mailimf_unstructured_free(comments->cm_value);
781 free(comments);
784 struct mailimf_keywords * mailimf_keywords_new(clist * kw_list)
786 struct mailimf_keywords * keywords;
788 keywords = malloc(sizeof(* keywords));
789 if (keywords == NULL)
790 return NULL;
792 keywords->kw_list = kw_list;
794 return keywords;
797 void mailimf_keywords_free(struct mailimf_keywords * keywords)
799 clist_foreach(keywords->kw_list, (clist_func) mailimf_phrase_free, NULL);
800 clist_free(keywords->kw_list);
801 free(keywords);
804 struct mailimf_return *
805 mailimf_return_new(struct mailimf_path * ret_path)
807 struct mailimf_return * return_path;
809 return_path = malloc(sizeof(* return_path));
810 if (return_path == NULL)
811 return NULL;
813 return_path->ret_path = ret_path;
815 return return_path;
818 void mailimf_return_free(struct mailimf_return * return_path)
820 mailimf_path_free(return_path->ret_path);
821 free(return_path);
825 struct mailimf_path * mailimf_path_new(char * pt_addr_spec)
827 struct mailimf_path * path;
829 path = malloc(sizeof(* path));
830 if (path == NULL)
831 return NULL;
833 path->pt_addr_spec = pt_addr_spec;
835 return path;
838 void mailimf_path_free(struct mailimf_path * path)
840 if (path->pt_addr_spec != NULL)
841 mailimf_addr_spec_free(path->pt_addr_spec);
842 free(path);
845 struct mailimf_optional_field *
846 mailimf_optional_field_new(char * fld_name, char * fld_value)
848 struct mailimf_optional_field * opt_field;
850 opt_field = malloc(sizeof(* opt_field));
851 if (opt_field == NULL)
852 return NULL;
854 opt_field->fld_name = fld_name;
855 opt_field->fld_value = fld_value;
857 return opt_field;
860 void mailimf_optional_field_free(struct mailimf_optional_field * opt_field)
862 mailimf_field_name_free(opt_field->fld_name);
863 mailimf_unstructured_free(opt_field->fld_value);
864 free(opt_field);
867 void mailimf_field_name_free(char * field_name)
869 free(field_name);