<commit_before>#include <stdio.h>
#include "common.h"
#include "prefs.h"

struct prefs prefs;

void prefs_default()
{
  prefs.tosimage = xstrdup("tos.img");
  prefs.stateimage = NULL;
  prefs.diskimage = NULL;
  prefs.diskimage2 = NULL;
  prefs.cartimage = NULL;
  prefs.hdimage = NULL;
}

void prefs_set(char *key, char *value)
{
  if(!strncasecmp("tosimage", key, 8)) {
    if(prefs.tosimage != NULL) free(prefs.tosimage);
    if(value != NULL)
      prefs.tosimage = xstrdup(value);
    else
      prefs.tosimage = NULL;
  } else if(!strncasecmp("stateimage", key, 10)) {
    if(prefs.stateimage != NULL) free(prefs.stateimage);
    if(value != NULL)
      prefs.stateimage = xstrdup(value);
    else
      prefs.stateimage = NULL;
  } else if(!strncasecmp("hdimage", key, 10)) {
    if(prefs.hdimage != NULL) free(prefs.hdimage);
    if(value != NULL)
      prefs.hdimage = xstrdup(value);
    else
      prefs.hdimage = NULL;
  } else if(!strncasecmp("diskimage2", key, 10)) {
    if(prefs.diskimage2 != NULL) free(prefs.diskimage2);
    if(value != NULL)
      prefs.diskimage2 = xstrdup(value);
    else
      prefs.diskimage2 = NULL;
  } else if(!strncasecmp("diskimage", key, 9)) {
    if(prefs.diskimage != NULL) free(prefs.diskimage);
    if(value != NULL)
      prefs.diskimage = xstrdup(value);
    else
      prefs.diskimage = NULL;
  } else if(!strncasecmp("cartimage", key, 9)) {
    if(prefs.cartimage != NULL) free(prefs.cartimage);
    if(value != NULL)
      prefs.cartimage = xstrdup(value);
    else
      prefs.cartimage = NULL;
  }
}

void prefs_init()
{
  prefs_default();
}

<commit_msg>No need to strdup a constant string<commit_after>#include <stdio.h>
#include "common.h"
#include "prefs.h"

struct prefs prefs;

void prefs_default()
{
  prefs.tosimage = "tos.img";
  prefs.stateimage = NULL;
  prefs.diskimage = NULL;
  prefs.diskimage2 = NULL;
  prefs.cartimage = NULL;
  prefs.hdimage = NULL;
}

void prefs_set(char *key, char *value)
{
  if(!strncasecmp("tosimage", key, 8)) {
    if(prefs.tosimage != NULL) free(prefs.tosimage);
    if(value != NULL)
      prefs.tosimage = xstrdup(value);
    else
      prefs.tosimage = NULL;
  } else if(!strncasecmp("stateimage", key, 10)) {
    if(prefs.stateimage != NULL) free(prefs.stateimage);
    if(value != NULL)
      prefs.stateimage = xstrdup(value);
    else
      prefs.stateimage = NULL;
  } else if(!strncasecmp("hdimage", key, 10)) {
    if(prefs.hdimage != NULL) free(prefs.hdimage);
    if(value != NULL)
      prefs.hdimage = xstrdup(value);
    else
      prefs.hdimage = NULL;
  } else if(!strncasecmp("diskimage2", key, 10)) {
    if(prefs.diskimage2 != NULL) free(prefs.diskimage2);
    if(value != NULL)
      prefs.diskimage2 = xstrdup(value);
    else
      prefs.diskimage2 = NULL;
  } else if(!strncasecmp("diskimage", key, 9)) {
    if(prefs.diskimage != NULL) free(prefs.diskimage);
    if(value != NULL)
      prefs.diskimage = xstrdup(value);
    else
      prefs.diskimage = NULL;
  } else if(!strncasecmp("cartimage", key, 9)) {
    if(prefs.cartimage != NULL) free(prefs.cartimage);
    if(value != NULL)
      prefs.cartimage = xstrdup(value);
    else
      prefs.cartimage = NULL;
  }
}

void prefs_init()
{
  prefs_default();
}


{'fraction_non_alphanumeric': 0.15313368323556653, 'fraction_numerical': 0.009262117937635072, 'mean_word_length': 3.302788844621514, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1124568', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1249, 'n_words': 234}