Changeset 090f1cb for protocols/jabber/xmltree.c
- Timestamp:
- 2006-10-07T13:01:02Z (17 years ago)
- Branches:
- master
- Children:
- 36e9f62
- Parents:
- 101d84f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/xmltree.c
r101d84f r090f1cb 528 528 int i; 529 529 530 for( i = 0; node->attr[i].key; i ++ ); 531 node->attr = g_renew( struct xt_attr, node->attr, i + 2 ); 532 node->attr[i].key = g_strdup( key ); 530 /* Now actually it'd be nice if we can also change existing attributes 531 (which actually means this function doesn't have the right name). 532 So let's find out if we have this attribute already... */ 533 for( i = 0; node->attr[i].key; i ++ ) 534 if( strcmp( node->attr[i].key, key ) == 0 ) 535 break; 536 537 if( node->attr[i].key == NULL ) 538 { 539 /* If not, allocate space for a new attribute. */ 540 node->attr = g_renew( struct xt_attr, node->attr, i + 2 ); 541 node->attr[i].key = g_strdup( key ); 542 node->attr[i+1].key = NULL; 543 } 544 else 545 { 546 /* Otherwise, free the old value before setting the new one. */ 547 g_free( node->attr[i].value ); 548 } 549 533 550 node->attr[i].value = g_strdup( value ); 534 node->attr[i+1].key = NULL; 535 } 551 }
Note: See TracChangeset
for help on using the changeset viewer.