[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20349 - gnunet/src/namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20349 - gnunet/src/namestore |
Date: |
Wed, 7 Mar 2012 17:58:44 +0100 |
Author: wachs
Date: 2012-03-07 17:58:44 +0100 (Wed, 07 Mar 2012)
New Revision: 20349
Modified:
gnunet/src/namestore/gnunet-service-namestore.c
Log:
- fix
Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c 2012-03-07 16:58:31 UTC
(rev 20348)
+++ gnunet/src/namestore/gnunet-service-namestore.c 2012-03-07 16:58:44 UTC
(rev 20349)
@@ -800,11 +800,10 @@
const struct GNUNET_CRYPTO_RsaSignature *signature)
{
struct RemoveRecordContext *rrc = cls;
- unsigned int rd_count_new = rd_count -1;
- struct GNUNET_NAMESTORE_RecordData rd_new[rd_count_new];
unsigned int c;
int res;
- int found = GNUNET_NO;
+ int found;
+ unsigned int rd_count_new;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name `%s 'currently has %u records\n",
name, rd_count);
@@ -816,7 +815,7 @@
}
/* Find record to remove */
- unsigned int c2 = 0;
+ found = GNUNET_SYSERR;
for (c = 0; c < rd_count; c++)
{
if ((rd[c].expiration.abs_value == rrc->rd->expiration.abs_value) &&
@@ -826,21 +825,31 @@
(0 == memcmp (rd[c].data, rrc->rd->data, rrc->rd->data_size)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found record to remove!\n",
rd_count);
- found = GNUNET_YES;
- continue;
+ found = c;
+ break;
}
- else
- {
- rd_new[c2] = rd[c];
- c2 ++;
- }
}
- if ((c2 != rd_count_new) || (found == GNUNET_NO))
+ if (GNUNET_SYSERR == found)
{
/* Could not find record to remove */
rrc->op_res = 2;
return;
}
+
+ rd_count_new = rd_count -1;
+ struct GNUNET_NAMESTORE_RecordData rd_new[rd_count_new];
+
+ unsigned int c2 = 0;
+ for (c = 0; c < rd_count; c++)
+ {
+ if (c != found)
+ {
+ GNUNET_assert (c2 < rd_count_new);
+ rd_new[c2] = rd[c];
+ c2++;
+ }
+ }
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name `%s' now has %u records\n", name,
rd_count_new);
/* Create new signature */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20349 - gnunet/src/namestore,
gnunet <=