<commit_before>#define _GNU_SOURCE
#include "check_confuse.h"
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>

static cfg_t *cfg;

int parse_ip_address(cfg_t *cfg, cfg_opt_t *opt, const char *value, void *result)
{
    int i;
    unsigned int e[4];
    unsigned char *addr;
    if (sscanf(value, "%u.%u.%u.%u", e + 0, e + 1, e + 2, e + 3) != 4)
    {
        /*cfg_error(cfg, "invalid IP address %s in section %s", value, cfg->name);*/
        return 1;
    }
    addr = (unsigned char *)malloc(sizeof(4));
    for (i = 0; i < 4; i++)
    {
        if (e[i] <= 0xff)
        {
            addr[i] = e[i];
        }
        else
        {
            free(addr);
            return 1;
        }
    }
    *(void **)result = (void *)addr;
    return 0;
}

static unsigned char *my_ether_aton(const char *addr)
{
    int i;
    static unsigned int e[6];
    static unsigned char ec[6];
    if(sscanf(addr, "%x:%x:%x:%x:%x:%x", &e[0], &e[1], &e[2], &e[3], &e[4], &e[5]) != 6)
    {
        return NULL;
    }
    for(i = 0; i < 6; i++)
    {
        if(e[i] <= 0xff)
            ec[i] = e[i];
        else
            return NULL;
    }
    return ec;
}

static char *my_ether_ntoa(unsigned char *addr)
{
    static char buf[18];
    sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
            addr[0], addr[0], addr[0], addr[0], addr[0], addr[0]);
    return buf;
}

static char *my_inet_ntoa(unsigned char *addr)
{
    static char buf[18];

    sprintf(buf, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);

    return buf;
}

int parse_ether_address(cfg_t *cfg, cfg_opt_t *opt, const char *value, void *result)<commit_msg>Fix cut-n-paste error in my_ether_ntoa()<commit_after>#define _GNU_SOURCE
#include "check_confuse.h"
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>

static cfg_t *cfg;

int parse_ip_address(cfg_t *cfg, cfg_opt_t *opt, const char *value, void *result)
{
    int i;
    unsigned int e[4];
    unsigned char *addr;
    if (sscanf(value, "%u.%u.%u.%u", e + 0, e + 1, e + 2, e + 3) != 4)
    {
        /*cfg_error(cfg, "invalid IP address %s in section %s", value, cfg->name);*/
        return 1;
    }
    addr = (unsigned char *)malloc(sizeof(4));
    for (i = 0; i < 4; i++)
    {
        if (e[i] <= 0xff)
        {
            addr[i] = e[i];
        }
        else
        {
            free(addr);
            return 1;
        }
    }
    *(void **)result = (void *)addr;
    return 0;
}

static unsigned char *my_ether_aton(const char *addr)
{
    int i;
    static unsigned int e[6];
    static unsigned char ec[6];
    if(sscanf(addr, "%x:%x:%x:%x:%x:%x", &e[0], &e[1], &e[2], &e[3], &e[4], &e[5]) != 6)
    {
        return NULL;
    }
    for(i = 0; i < 6; i++)
    {
        if(e[i] <= 0xff)
            ec[i] = e[i];
        else
            return NULL;
    }
    return ec;
}

static char *my_ether_ntoa(unsigned char *addr)
{
    static char buf[18];

    sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
            addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);

    return buf;
}

static char *my_inet_ntoa(unsigned char *addr)
{
    static char buf[16];

    sprintf(buf, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);

    return buf;
}

int parse_ether_address(cfg_t *cfg, cfg_opt_t *opt, const char *value, void *result)
{'fraction_non_alphanumeric': 0.1864971238268241, 'fraction_numerical': 0.030881017257039057, 'mean_word_length': 2.3139418254764292, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 11, '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': '5246773', 'n_tokens_mistral': 1368, 'n_tokens_neox': 1306, 'n_words': 333}