<commit_before>#include <mongoc.h>
#include <mongoc-client-private.h>
#include <mongoc-event-private.h>


static void
test_load (mongoc_client_t *client,
           unsigned         iterations)
{
   mongoc_event_t ev;
   bson_uint32_t hint;
   bson_error_t error;
   unsigned i;
   bson_t b;
   bson_t f;

   bson_init(&f);

   bson_init(&b);
   bson_append_int32(&b, "ping", 4, 1);
   bson_destroy(&b);

   for (i = 0; i < iterations; i++) {
      memset(&error, 0, sizeof error);
      memset(&ev, 0, sizeof ev);
      ev.any.type = MONGOC_OPCODE_QUERY;
      ev.any.opcode = MONGOC_OPCODE_QUERY;
      ev.query.flags = 0;
      ev.query.ns = "admin.$cmd";
      ev.query.nslen = 10;
      ev.query.skip = 0;
      ev.query.n_return = 1;
      ev.query.query = &b;
      ev.query.fields = NULL;
      if (!(hint = mongoc_client_send(client, &ev, 0, &error))) {
         MONGOC_DEBUG("Send failed: %s", error.message);
         bson_error_destroy(&error);
         continue;
      }
      if (!mongoc_client_recv(client, &ev, hint, &error)) {
         MONGOC_DEBUG("Recv failed: %s", error.message);
         bson_error_destroy(&error);
      }
   }<commit_msg>tests: cleanup received event.<commit_after>#include <mongoc.h>
#include <mongoc-client-private.h>
#include <mongoc-event-private.h>


static void
test_load (mongoc_client_t *client,
           unsigned         iterations)
{
   mongoc_event_t ev;
   bson_uint32_t hint;
   bson_error_t error;
   unsigned i;
   bson_t b;
   bson_t f;

   bson_init(&f);

   bson_init(&b);
   bson_append_int32(&b, "ping", 4, 1);
   bson_destroy(&b);

   for (i = 0; i < iterations; i++) {
      memset(&error, 0, sizeof error);
      memset(&ev, 0, sizeof ev);
      ev.any.type = MONGOC_OPCODE_QUERY;
      ev.any.opcode = MONGOC_OPCODE_QUERY;
      ev.query.flags = 0;
      ev.query.ns = "admin.$cmd";
      ev.query.nslen = 10;
      ev.query.skip = 0;
      ev.query.n_return = 1;
      ev.query.query = &b;
      ev.query.fields = NULL;
      if (!(hint = mongoc_client_send(client, &ev, 0, &error))) {
         MONGOC_DEBUG("Send failed: %s", error.message);
         bson_error_destroy(&error);
         continue;
      }
      if (!mongoc_client_recv(client, &ev, hint, &error)) {
         MONGOC_DEBUG("Recv failed: %s", error.message);
         bson_error_destroy(&error);
      }
      mongoc_event_destroy(&ev);
   }
{'fraction_non_alphanumeric': 0.14406065711878685, 'fraction_numerical': 0.012636899747262006, 'mean_word_length': 2.566066066066066, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '871177', 'n_tokens_mistral': 926, 'n_tokens_neox': 890, 'n_words': 176}