コード例 #1
0
void
msg_clear(struct msg *tmp)
{
  if (tmp->from_name_set == 1) {
    free(tmp->from_name_data);
    tmp->from_name_data = NULL;
    tmp->from_name_set = 0;
  }
  if (tmp->to_name_set == 1) {
    free(tmp->to_name_data);
    tmp->to_name_data = NULL;
    tmp->to_name_set = 0;
  }
  if (tmp->attack_set == 1) {
    kill_free(tmp->attack_data);
    tmp->attack_data = NULL;
    tmp->attack_set = 0;
  }
  if (tmp->run_set == 1) {
    int i;
    for (i = 0; i < tmp->run_length; ++i) {
      run_free(tmp->run_data[i]);
    }
    free(tmp->run_data);
    tmp->run_data = NULL;
    tmp->run_set = 0;
    tmp->run_length = 0;
    tmp->run_num_allocated = 0;
  }
}
コード例 #2
0
ファイル: main.c プロジェクト: RWTH-OS/HermitCore
int main(int argc, char *argv[])
{
    printf("hourglass\n");

    opt(argc, argv, &opts);
    init(&opts);

    report_params(&opts);

    setup(&opts);
    run(&opts, &results);
    setdown(&opts);

    report(&opts, &results);

    run_free(&opts, &results);

    deinit(&opts);

    return EXIT_SUCCESS;
}
コード例 #3
0
void
msg_free(struct msg *tmp)
{
  if (tmp->from_name_data != NULL)
      free (tmp->from_name_data); 
  if (tmp->to_name_data != NULL)
      free (tmp->to_name_data); 
  if (tmp->attack_data != NULL)
      kill_free(tmp->attack_data); 
  if (tmp->run_data != NULL) {
    int i;
    for (i = 0; i < tmp->run_length; ++i) {
      run_free(tmp->run_data[i]); 
      tmp->run_data[i] = NULL;
    }
    free(tmp->run_data);
    tmp->run_data = NULL;
    tmp->run_length = 0;
    tmp->run_num_allocated = 0;
  }
  free(tmp);
}