aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps_sampler.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-01-28 16:56:47 +0000
committerBart Polot <bart@net.in.tum.de>2015-01-28 16:56:47 +0000
commitf211dbecd475ad630e54b29e2bd054c139aa1273 (patch)
tree414ff9e5452d477cd00a6a2cd0998001192e0489 /src/rps/gnunet-service-rps_sampler.c
parent9a73ec66434eb1bb579dda36cb7a1c4c6fd10b8b (diff)
downloadgnunet-f211dbecd475ad630e54b29e2bd054c139aa1273.tar.gz
gnunet-f211dbecd475ad630e54b29e2bd054c139aa1273.zip
- never resize to 0
Diffstat (limited to 'src/rps/gnunet-service-rps_sampler.c')
-rw-r--r--src/rps/gnunet-service-rps_sampler.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c
index 01d8aa748..419110440 100644
--- a/src/rps/gnunet-service-rps_sampler.c
+++ b/src/rps/gnunet-service-rps_sampler.c
@@ -417,8 +417,8 @@ RPS_sampler_get_size ()
417 * 417 *
418 * @param new_size the new size of the sampler 418 * @param new_size the new size of the sampler
419 */ 419 */
420 void 420static void
421RPS_sampler_resize (unsigned int new_size) 421sampler_resize (unsigned int new_size)
422{ 422{
423 unsigned int old_size; 423 unsigned int old_size;
424 uint32_t i; 424 uint32_t i;
@@ -481,6 +481,31 @@ RPS_sampler_resize (unsigned int new_size)
481 481
482 482
483/** 483/**
484 * Grow or shrink the size of the sampler.
485 *
486 * @param new_size the new size of the sampler
487 */
488void
489RPS_sampler_resize (unsigned int new_size)
490{
491 GNUNET_assert (0 < new_size);
492 sampler_resize (new_size);
493}
494
495
496/**
497 * Empty the sampler.
498 *
499 * @param new_size the new size of the sampler
500 */
501void
502RPS_sampler_empty ()
503{
504 sampler_resize (0);
505}
506
507
508/**
484 * Initialise a tuple of sampler elements. 509 * Initialise a tuple of sampler elements.
485 * 510 *
486 * @param init_size the size the sampler is initialised with 511 * @param init_size the size the sampler is initialised with