<commit_before>/*!
 * process node list
 */

#include <string.h>

#include "meta.h"

#include "node.h"

extern const MPT_STRUCT(node) *mpt_node_foreach(const MPT_STRUCT(node) *head, MPT_TYPE(PropertyHandler) proc, void *parg, int match)
{
	if (!head || !proc) {
		return 0;
	}
	do {
		static const char norm[] = "\0";
		MPT_INTERFACE(metatype) *curr;
		MPT_STRUCT(property) prop;
		int flag;
		
		/* skip masked types */
		flag = head->children ? MPT_ENUM(TraverseNonLeafs) : MPT_ENUM(TraverseLeafs);
		if (flag & match) {
			continue;
		}
		prop.desc = 0;
		
		/* get current identifier */
		if (mpt_identifier_len(&head->ident) > 0) {
			prop.name = mpt_identifier_data(&head->ident);
		}
		/* avoid empty property */
		else if (!(match & MPT_ENUM(TraverseEmpty))) {
			continue;
		}
		else {
			prop.name = norm;
		}
		/* get data from current metatype */
		if ((curr = head->_meta)) {
			/* skip non-default values */<commit_msg>fix: missed comparison for changed mask logic<commit_after>/*!
 * process node list
 */

#include <string.h>

#include "meta.h"

#include "node.h"

extern const MPT_STRUCT(node) *mpt_node_foreach(const MPT_STRUCT(node) *head, MPT_TYPE(PropertyHandler) proc, void *parg, int match)
{
	if (!head || !proc) {
		return 0;
	}
	do {
		static const char norm[] = "\0";
		MPT_INTERFACE(metatype) *curr;
		MPT_STRUCT(property) prop;
		int flag;
		
		/* skip masked types */
		flag = head->children ? MPT_ENUM(TraverseNonLeafs) : MPT_ENUM(TraverseLeafs);
		if (!(flag & match)) {
			continue;
		}
		prop.desc = 0;
		
		/* get current identifier */
		if (mpt_identifier_len(&head->ident) > 0) {
			prop.name = mpt_identifier_data(&head->ident);
		}
		/* avoid empty property */
		else if (!(match & MPT_ENUM(TraverseEmpty))) {
			continue;
		}
		else {
			prop.name = norm;
		}
		/* get data from current metatype */
		if ((curr = head->_meta)) {
			/* skip non-default values */
{'fraction_non_alphanumeric': 0.15255128879537086, 'fraction_numerical': 0.004208311415044713, 'mean_word_length': 3.4129930394431556, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '4411158', 'n_tokens_mistral': 772, 'n_tokens_neox': 697, 'n_words': 170}