Changeset f9df2f0
- Timestamp:
- Jun 25, 2011, 3:26:15 AM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- e4d7cb6
- Parents:
- fc8a87a
- git-author:
- David Benjamin <davidben@mit.edu> (03/10/11 14:57:25)
- git-committer:
- David Benjamin <davidben@mit.edu> (06/25/11 03:26:15)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
message.c
r6829afc 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)); … … 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); -
owl.h
rfc8a87a rf9df2f0 363 363 int delete; 364 364 const char *hostname; 365 owl_list attributes;/* this is a list of pairs */365 GPtrArray *attributes; /* this is a list of pairs */ 366 366 char *timestr; 367 367 time_t time; -
perlconfig.c
r6829afc rf9df2f0 115 115 } 116 116 117 j=owl_list_get_size(&(m->attributes)); 118 for(i=0; i<j; i++) { 119 pair=owl_list_get_element(&(m->attributes), i); 117 for (i = 0; i < m->attributes->len; i++) { 118 pair = m->attributes->pdata[i]; 120 119 (void)hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)), 121 120 owl_new_sv(owl_pair_get_value(pair)),0);
Note: See TracChangeset
for help on using the changeset viewer.