<commit_before>/*
 * This file is part of libdom.
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license.php
 * Copyright 2009 <NAME> <<EMAIL>>
 */

#include <assert.h>
#include <stdlib.h>

#include "events/event.h"
#include "events/event_listener.h"
#include "events/event_target.h"

#include "core/document.h"
#include "core/node.h"
#include "core/string.h"

#include "utils/utils.h"
#include "utils/validate.h"

static void event_target_destroy_listeners(struct listener_entry *list)
{
	const struct listener_entry *head = list;

	do {
		struct listener_entry *next = 
				(struct listener_entry *) list->list.next;

		list_del(&list->list);
		dom_event_listener_unref(list->listener);
		dom_string_unref(list->type);
		free(list);

		list = next;
	} while (list != head);
}

/* Initialise this EventTarget */
dom_exception _dom_event_target_internal_initialise(
		dom_event_target_internal *eti)<commit_msg>Fix listener destructor loop again<commit_after>/*
 * This file is part of libdom.
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license.php
 * Copyright 2009 <NAME> <<EMAIL>>
 */

#include <assert.h>
#include <stdlib.h>

#include "events/event.h"
#include "events/event_listener.h"
#include "events/event_target.h"

#include "core/document.h"
#include "core/node.h"
#include "core/string.h"

#include "utils/utils.h"
#include "utils/validate.h"

static void event_target_destroy_listeners(struct listener_entry *list)
{
	struct listener_entry *next = NULL;

	for (; list != next; list = next) {
		next = (struct listener_entry *) list->list.next;

		list_del(&list->list);
		dom_event_listener_unref(list->listener);
		dom_string_unref(list->type);
		free(list);
	}
}

/* Initialise this EventTarget */
dom_exception _dom_event_target_internal_initialise(
		dom_event_target_internal *eti)
{'fraction_non_alphanumeric': 0.13477801268498943, 'fraction_numerical': 0.004228329809725159, 'mean_word_length': 4.600591715976331, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7557076', 'n_tokens_mistral': 674, 'n_tokens_neox': 638, 'n_words': 139}