<commit_before>#include <ctype.h>
#include <err.h>
#include <stdlib.h>
#include <string.h>

#include "pkg_compat.h"

static void
str_lowercase(char *str)
{
	while (*str) {
		*str = tolower(*str);
		++str;
	}
}


static struct plist *
pkg_compat_new_plist_entry(void)
{
	struct plist *ret;

	ret = (struct plist *)malloc(sizeof(struct plist));
	bzero(ret, sizeof(struct plist));
	return ret;
}

static void
pkg_compat_delete_plist(struct oldpackage *pkg, bool all, enum plist_t type, const char *name)
{
	struct plist *p = pkg->head;

	while (p) {
		struct plist *pnext = p->next;

		if (p->type == type && (!name || !strcmp(name, p->name))) {
			free(p->name);
			if (p->prev)
				p->prev->next = pnext;
			else
				pkg->head = pnext;
			if (pnext)
				pnext->prev = p->prev;
			else
				pkg->tail = p->prev;
			free(p);
			if (!all)
				return;
			p = pnext;
		}
		else
			p = p->next;
	}
}

static void
pkg_compat_free_plist(struct oldpackage *pkg)
{
	struct plist *p = pkg->head;

	while (p) {
		struct plist *p1 = p->next;

		free(p->name);
		free(p);
		p = p1;
	}
	pkg->head = pkg->tail = NULL;
}

static int
pkg_compat_plist_cmd(const char *s, char **arg)
{
	char cmd[FILENAME_MAX + 20];    /* 20 == fudge for max cmd len */
	char *cp;
	const char *sp;

	strlcpy(cmd, s, sizeof(cmd));
	str_lowercase(cmd);
	cp = cmd;<commit_msg>Remove some now uneeded function<commit_after>#include <ctype.h>
#include <err.h>
#include <stdlib.h>
#include <string.h>

#include "pkg_compat.h"

static void
str_lowercase(char *str)
{
	while (*str) {
		*str = tolower(*str);
		++str;
	}
}


static int
pkg_compat_plist_cmd(const char *s, char **arg)
{
	char cmd[FILENAME_MAX + 20];    /* 20 == fudge for max cmd len */
	char *cp;
	const char *sp;

	strlcpy(cmd, s, sizeof(cmd));
	str_lowercase(cmd);
	cp = cmd;
{'fraction_non_alphanumeric': 0.16648106904231627, 'fraction_numerical': 0.005567928730512249, 'mean_word_length': 3.5609137055837565, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 30, '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': '2181878', 'n_tokens_mistral': 808, 'n_tokens_neox': 730, 'n_words': 187}