<commit_before>#include <stdlib.h>
#include <string.h>
#include <sys/ptrace.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/user.h>
#include <sys/wait.h>
#include <ruby.h>
#include <ruby/thread.h>

typedef struct pt_tracee {
  pid_t pid;
  int activated;
  int dead;
  struct pt_tracee *next;
} pt_tracee_t;

typedef struct pt_wait_args {
  int *status;
  pid_t pid;
} pt_wait_args_t;

static pt_tracee_t *
pt_tracee_add(pt_tracee_t **headpp, pid_t pid)
{
  pt_tracee_t *tracee = malloc(sizeof(pt_tracee_t));

  if (tracee == NULL) {
    exit(EXIT_FAILURE);
  }

  tracee->pid       = pid;
  tracee->activated = 0;
  tracee->dead      = 0;
  tracee->next      = (struct pt_tracee *)*headpp;

  (*headpp) = tracee;

  return tracee;
}

static pt_tracee_t *
pt_tracee_find_or_add(pt_tracee_t **headpp, pid_t pid)
{
  pt_tracee_t *tracee = *headpp;

  while (tracee != NULL) {
    if (tracee->pid == pid) {
      return tracee;
    }

    tracee = tracee->next;
  }

  return pt_tracee_add(headpp, pid);
}

static int
pt_tracee_wipedoutq(pt_tracee_t *headp)
{
  pt_tracee_t *tracee = headp;

  while (tracee != NULL) {
    if (tracee->dead == 0) {
      return 0;
    }

    tracee = tracee->next;
  }

  return 1;
}

static void
pt_tracee_free(pt_tracee_t **headpp)
{
  pt_tracee_t *tracee  = *headpp;

  if (tracee->next) {
    pt_tracee_free(&tracee->next);
  }

  free(tracee);
  (*headpp) = NULL;
}

static int
pt_io_closedq(VALUE io)
{
  return rb_funcall(io, rb_intern("closed?"), 0) == Qtrue;<commit_msg>Don't assign over twice<commit_after>#include <stdlib.h>
#include <string.h>
#include <sys/ptrace.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/user.h>
#include <sys/wait.h>
#include <ruby.h>
#include <ruby/thread.h>

typedef struct pt_tracee {
  pid_t pid;
  int activated;
  int dead;
  struct pt_tracee *next;
} pt_tracee_t;

typedef struct pt_wait_args {
  int *status;
  pid_t pid;
} pt_wait_args_t;

static pt_tracee_t *
pt_tracee_add(pt_tracee_t **headpp, pid_t pid)
{
  pt_tracee_t *tracee = malloc(sizeof(pt_tracee_t));

  if (tracee == NULL) {
    exit(EXIT_FAILURE);
  }

  tracee->pid       = pid;
  tracee->activated = 0;
  tracee->dead      = 0;
  tracee->next      = (struct pt_tracee *)*headpp;

  (*headpp) = tracee;

  return tracee;
}

static pt_tracee_t *
pt_tracee_find_or_add(pt_tracee_t **headpp, pid_t pid)
{
  pt_tracee_t *tracee = *headpp;

  while (tracee != NULL) {
    if (tracee->pid == pid) {
      return tracee;
    }

    tracee = tracee->next;
  }

  return pt_tracee_add(headpp, pid);
}

static int
pt_tracee_wipedoutq(pt_tracee_t *headp)
{
  pt_tracee_t *tracee = headp;

  while (tracee != NULL) {
    if (tracee->dead == 0) {
      return 0;
    }

    tracee = tracee->next;
  }

  return 1;
}

static void
pt_tracee_free(pt_tracee_t **headpp)
{
  pt_tracee_t *tracee = *headpp;

  if (tracee->next) {
    pt_tracee_free(&tracee->next);
  }

  free(tracee);
  tracee = NULL;
}

static int
pt_io_closedq(VALUE io)
{
  return rb_funcall(io, rb_intern("closed?"), 0) == Qtrue;
{'fraction_non_alphanumeric': 0.14126880313930673, 'fraction_numerical': 0.003924133420536298, 'mean_word_length': 3.531851851851852, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 41, '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': '2207010', 'n_tokens_mistral': 1361, 'n_tokens_neox': 1304, 'n_words': 260}