diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-25 23:22:33 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-25 23:22:33 +0000 |
commit | 124f3e77a5e022f5f7ab49df49023d0080bcbbb4 (patch) | |
tree | 2c88e59709c52594d2c98c6df52671419c957162 /src/fs/gnunet-service-fs_pe.c | |
parent | 8306257cfea6b5ca5d7cd0119b8d1369f422a07f (diff) | |
download | gnunet-124f3e77a5e022f5f7ab49df49023d0080bcbbb4.tar.gz gnunet-124f3e77a5e022f5f7ab49df49023d0080bcbbb4.zip |
-reduce calls in get_latest()
Diffstat (limited to 'src/fs/gnunet-service-fs_pe.c')
-rw-r--r-- | src/fs/gnunet-service-fs_pe.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index beb435c0c..ede109c2d 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c | |||
@@ -355,18 +355,23 @@ get_latest (const struct GSF_RequestPlan *rp) | |||
355 | { | 355 | { |
356 | struct GSF_PendingRequest *ret; | 356 | struct GSF_PendingRequest *ret; |
357 | struct GSF_PendingRequestPlanBijection *bi; | 357 | struct GSF_PendingRequestPlanBijection *bi; |
358 | const struct GSF_PendingRequestData *rprd; | ||
359 | const struct GSF_PendingRequestData *prd; | ||
358 | 360 | ||
359 | bi = rp->pe_head; | 361 | bi = rp->pe_head; |
360 | if (NULL == bi) | 362 | if (NULL == bi) |
361 | return NULL; /* should never happen */ | 363 | return NULL; /* should never happen */ |
362 | ret = bi->pr; | 364 | ret = bi->pr; |
363 | bi = bi->next_PE; | 365 | rprd = GSF_pending_request_get_data_ (ret); |
364 | while (NULL != bi) | 366 | for (bi = bi->next_PE; NULL != bi; bi = bi->next_PE) |
365 | { | 367 | { |
366 | if (GSF_pending_request_get_data_ (bi->pr)->ttl.abs_value_us > | 368 | prd = GSF_pending_request_get_data_ (bi->pr); |
367 | GSF_pending_request_get_data_ (ret)->ttl.abs_value_us) | 369 | if (prd->ttl.abs_value_us > |
370 | rprd->ttl.abs_value_us) | ||
371 | { | ||
368 | ret = bi->pr; | 372 | ret = bi->pr; |
369 | bi = bi->next_PE; | 373 | rprd = prd; |
374 | } | ||
370 | } | 375 | } |
371 | return ret; | 376 | return ret; |
372 | } | 377 | } |