From patchwork Wed Jul 15 13:59:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Edwe Cowley X-Patchwork-Id: 5127 Return-Path: Received: from mail-bw0-f217.google.com (mail-bw0-f217.google.com [209.85.218.217]) by open-mesh.net (Postfix) with ESMTP id 7DE2F1543AD for ; Wed, 15 Jul 2009 14:23:26 +0000 (UTC) Received: by bwz17 with SMTP id 17so1555657bwz.45 for ; Wed, 15 Jul 2009 06:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=zqc35Z+EWgWfD1gHWibLIBpvl9zlq5f13gyI6Q6mgpY=; b=jpeRaOByOyrgeKa3gxKr/9giFeMxcowe0bttDx3ZyqlwUkCeCIK9dplstoq3QQmgSs pzNXv2R63r2bJcjT1m7WAs7lOrGNlFKwHE9eQ4Zrx1MwCaMbqFEn7lFzuItfQ5oxTrLH hn783S9d3g5GG310ZPhN9IeOdRn8/NA2LOX1s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=jj1j90uCO8ptNQSl3k1Jxj81TlLDv5oWBrh8KZTr/I+4mpWLGJuYy0MLHg11orxPfO BI7dRbwRieWemJ1s9K+AOtCt5yQZEpRS22Q8t3cwwUYxfVeljZ2KCgSsPd1lWHdUio8F k4M+tSjdqvLApk1Eyma9NcsbLn1XU1THjdSJo= MIME-Version: 1.0 Received: by 10.223.127.8 with SMTP id e8mr3992053fas.95.1247666372334; Wed, 15 Jul 2009 06:59:32 -0700 (PDT) Date: Wed, 15 Jul 2009 15:59:32 +0200 Message-ID: From: Edwe Cowley To: b.a.t.m.a.n@lists.open-mesh.net Subject: [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output X-BeenThere: b.a.t.m.a.n@lists.open-mesh.net X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jul 2009 14:23:28 -0000 Revision 1271 introduced a bug on the call to hash->compare() that caused duplicate routes to appear in the output.  Inverted the conditional and now it works. Signed-off-by: Edwe Cowley return hash_remove_bucket(hash, &hash_it_t); } Index: batman/hash.c =================================================================== --- batman/hash.c (revision 1343) +++ batman/hash.c (working copy) @@ -179,7 +179,7 @@ bucket = hash->table[index]; while (bucket != NULL) { - if (hash->compare(bucket->data, data)) + if (!(hash->compare(bucket->data, data))) return -1; prev_bucket = bucket; @@ -217,7 +217,7 @@ bucket = hash->table[index]; while (bucket != NULL) { - if (hash->compare(bucket->data, keydata)) + if (!(hash->compare(bucket->data, keydata))) return bucket->data; bucket = bucket->next; @@ -260,7 +260,7 @@ hash_it_t.prev_bucket = NULL; while (hash_it_t.bucket != NULL) { - if (hash->compare(hash_it_t.bucket->data, data)) { + if (!(hash->compare(hash_it_t.bucket->data, data))) { hash_it_t.first_bucket = (hash_it_t.bucket == hash->table[hash_it_t.index] ? &hash->table[ hash_it_t.index ] : NULL);