<commit_before>Grpc::XS::Call
new(const char *class,  Grpc::XS::Channel channel,  \
    const char* method, Grpc::XS::Timeval deadline, ... )
  PREINIT:
    CallCTX* ctx = (CallCTX *)malloc( sizeof(CallCTX) );
    ctx->wrapped = NULL;
  CODE:

    // Params:
    //    * channel       - channel object
    //    * method        - string
    //    * deadline      - timeval object
    //    * host_override - string (optional)

    if ( items > 5 ) {
      croak("Too many variables for constructor Grpc::XS::Call");
    }
#if defined(GRPC_VERSION_1_2)
    grpc_slice host_override;
    if ( items == 5) {
      host_override = grpc_slice_from_sv(ST(4));
    } else {
      host_override = grpc_empty_slice();
    }

    grpc_slice method_slice = grpc_slice_from_static_string(method);
    ctx->wrapped = grpc_channel_create_call(
              channel->wrapped, NULL, GRPC_PROPAGATE_DEFAULTS, completion_queue,
              method_slice, &host_override, deadline->wrapped, NULL);
    grpc_slice_unref(host_override);
    grpc_slice_unref(method_slice);
#else
    const char* host_override = NULL;
    if ( items == 5) {
      host_override = SvPV_nolen(ST(4));
    }

    ctx->wrapped = grpc_channel_create_call(
              channel->wrapped, NULL, GRPC_PROPAGATE_DEFAULTS, completion_queue,
              method, host_override, deadline->wrapped, NULL);
#endif

    RETVAL = ctx;
  OUTPUT: RETVAL

SV*
startBatch(Grpc::XS::Call self, ...)<commit_msg>Fix 'Host' argument for creating calls<commit_after>Grpc::XS::Call
new(const char *class,  Grpc::XS::Channel channel,  \
    const char* method, Grpc::XS::Timeval deadline, ... )
  PREINIT:
    CallCTX* ctx = (CallCTX *)malloc( sizeof(CallCTX) );
    ctx->wrapped = NULL;
  CODE:

    // Params:
    //    * channel       - channel object
    //    * method        - string
    //    * deadline      - timeval object
    //    * host_override - string (optional)

    if ( items > 5 ) {
      croak("Too many variables for constructor Grpc::XS::Call");
    }
#if defined(GRPC_VERSION_1_2)
    grpc_slice host_override;
    grpc_slice* host_override_ptr = NULL;

    if ( items == 5) {
      host_override = grpc_slice_from_sv(ST(4));
      host_override_ptr = &host_override;
    }

    grpc_slice method_slice = grpc_slice_from_static_string(method);
    ctx->wrapped = grpc_channel_create_call(
              channel->wrapped, NULL, GRPC_PROPAGATE_DEFAULTS, completion_queue,
              method_slice, host_override_ptr, deadline->wrapped, NULL);

    if (host_override_ptr) {
        grpc_slice_unref(host_override);
    }
    grpc_slice_unref(method_slice);
#else
    const char* host_override = NULL;
    if ( items == 5) {
      host_override = SvPV_nolen(ST(4));
    }

    ctx->wrapped = grpc_channel_create_call(
              channel->wrapped, NULL, GRPC_PROPAGATE_DEFAULTS, completion_queue,
              method, host_override, deadline->wrapped, NULL);
#endif

    RETVAL = ctx;
  OUTPUT: RETVAL

SV*
startBatch(Grpc::XS::Call self, ...)
{'fraction_non_alphanumeric': 0.1187624750499002, 'fraction_numerical': 0.004657351962741184, 'mean_word_length': 2.8111533586818758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '4384928', 'n_tokens_mistral': 1023, 'n_tokens_neox': 990, 'n_words': 201}