Changes in message.c [d427f08:f9df2f0]
Legend:
- Unmodified
- Added
- Removed
-
message.c
rd427f08 rf9df2f0 43 43 44 44 owl_message_set_hostname(m, ""); 45 owl_list_create(&(m->attributes));45 m->attributes = g_ptr_array_new(); 46 46 47 47 /* save the time */ … … 58 58 void owl_message_set_attribute(owl_message *m, const char *attrname, const char *attrvalue) 59 59 { 60 int i , j;60 int i; 61 61 owl_pair *p = NULL, *pair = NULL; 62 62 … … 64 64 65 65 /* look for an existing pair with this key, */ 66 j=owl_list_get_size(&(m->attributes)); 67 for (i=0; i<j; i++) { 68 p=owl_list_get_element(&(m->attributes), i); 66 for (i = 0; i < m->attributes->len; i++) { 67 p = m->attributes->pdata[i]; 69 68 if (owl_pair_get_key(p) == attrname) { 70 69 g_free(owl_pair_get_value(p)); … … 77 76 pair = g_new(owl_pair, 1); 78 77 owl_pair_create(pair, attrname, NULL); 79 owl_list_append_element(&(m->attributes), pair);78 g_ptr_array_add(m->attributes, pair); 80 79 } 81 80 owl_pair_set_value(pair, owl_validate_or_convert(attrvalue)); … … 87 86 const char *owl_message_get_attribute_value(const owl_message *m, const char *attrname) 88 87 { 89 int i , j;88 int i; 90 89 owl_pair *p; 91 90 GQuark quark; … … 97 96 attrname = g_quark_to_string(quark); 98 97 99 j=owl_list_get_size(&(m->attributes)); 100 for (i=0; i<j; i++) { 101 p=owl_list_get_element(&(m->attributes), i); 98 for (i = 0; i < m->attributes->len; i++) { 99 p = m->attributes->pdata[i]; 102 100 if (owl_pair_get_key(p) == attrname) { 103 101 return(owl_pair_get_value(p)); … … 118 116 */ 119 117 void owl_message_attributes_tofmtext(const owl_message *m, owl_fmtext *fm) { 120 int i , j;118 int i; 121 119 owl_pair *p; 122 120 char *buff, *tmpbuff; … … 124 122 owl_fmtext_init_null(fm); 125 123 126 j=owl_list_get_size(&(m->attributes)); 127 for (i=0; i<j; i++) { 128 p=owl_list_get_element(&(m->attributes), i); 124 for (i = 0; i < m->attributes->len; i++) { 125 p = m->attributes->pdata[i]; 129 126 130 127 tmpbuff = g_strdup(owl_pair_get_value(p)); … … 580 577 581 578 /* caller must free return value. */ 582 G_GNUC_WARN_UNUSED_RESULTchar *owl_message_get_cc(const owl_message *m)579 CALLER_OWN char *owl_message_get_cc(const owl_message *m) 583 580 { 584 581 const char *cur; … … 597 594 598 595 /* caller must free return value */ 599 G_GNUC_WARN_UNUSED_RESULTGList *owl_message_get_cc_without_recipient(const owl_message *m)596 CALLER_OWN GList *owl_message_get_cc_without_recipient(const owl_message *m) 600 597 { 601 598 char *cc, *shortuser, *recip; … … 1004 1001 void owl_message_cleanup(owl_message *m) 1005 1002 { 1006 int i , j;1003 int i; 1007 1004 owl_pair *p; 1008 1005 #ifdef HAVE_LIBZEPHYR … … 1014 1011 1015 1012 /* free all the attributes */ 1016 j=owl_list_get_size(&(m->attributes)); 1017 for (i=0; i<j; i++) { 1018 p=owl_list_get_element(&(m->attributes), i); 1013 for (i = 0; i < m->attributes->len; i++) { 1014 p = m->attributes->pdata[i]; 1019 1015 g_free(owl_pair_get_value(p)); 1020 1016 g_free(p); 1021 1017 } 1022 1018 1023 owl_list_cleanup(&(m->attributes), NULL);1019 g_ptr_array_free(m->attributes, true); 1024 1020 1025 1021 owl_message_invalidate_format(m);
Note: See TracChangeset
for help on using the changeset viewer.