Changeset 842cd8d
- Timestamp:
- 2010-03-18T11:22:17Z (15 years ago)
- Branches:
- master
- Children:
- 638feab
- Parents:
- 00a0bc5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber_util.c
r00a0bc5 r842cd8d 4 4 * Jabber module - Misc. stuff * 5 5 * * 6 * Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net> *6 * Copyright 2006-2010 Wilmer van der Gaast <wilmer@gaast.net> 7 7 * * 8 8 * This program is free software; you can redistribute it and/or modify * … … 556 556 { 557 557 struct jabber_data *jd = ic->proto_data; 558 struct jabber_buddy *bud, *prev , *bi;558 struct jabber_buddy *bud, *prev = NULL, *bi; 559 559 char *s, *full_jid; 560 560 … … 567 567 { 568 568 if( bud->next ) 569 bud = bud->next;569 bud = (prev=bud)->next; 570 570 571 571 /* If there's only one item in the list (and if the resource … … 587 587 else 588 588 { 589 for( bi = bud , prev = NULL; bi; bi = (prev=bi)->next )589 for( bi = bud; bi; bi = (prev=bi)->next ) 590 590 if( strcmp( bi->resource, s + 1 ) == 0 ) 591 591 break; … … 598 598 prev->next = bi->next; 599 599 else 600 /* The hash table should point at the second 601 item, because we're removing the first. */ 600 /* Don't think this should ever happen anymore. */ 602 601 g_hash_table_replace( jd->buddies, bi->bare_jid, bi->next ); 603 602 -
tests/check_jabber_util.c
r00a0bc5 r842cd8d 84 84 fail_unless( jabber_buddy_remove( ic, "nekkid@lamejab.net" ) ); 85 85 fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) ); 86 87 /* Fixing a bug in this branch that caused information to get lost when 88 removing the first full JID from a list. */ 89 jabber_buddy_add( ic, "bugtest@google.com/A" ); 90 jabber_buddy_add( ic, "bugtest@google.com/B" ); 91 jabber_buddy_add( ic, "bugtest@google.com/C" ); 92 fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/A" ) ); 93 fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/B" ) ); 94 fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/C" ) ); 86 95 } 87 96
Note: See TracChangeset
for help on using the changeset viewer.