<commit_before>#include <arpa/inet.h>
#include <sys/time.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zlib.h>

#include "common.h"
#include "library.h"
#include "pool.h"

#include "msg.h"

link_t msg_process_handlers;

#define IS_SYSCONTROL_CMD(ch, op) (((ch >> 2) & MSG_OP_MASK) == op)

static unsigned char syscontrol_cmds[] = {
    /* op, request_mask, reply_mask */
    SYSCONTROL_MASK(SYS_LOGIN, 1, 1),
    SYSCONTROL_MASK(SYS_PING,  0, 0),
};

inline int find_cmd(unsigned char op, unsigned char masks[2])
{
    size_t i;
    for (i = 0; i < sizeof(syscontrol_cmds); ++i)
    {
        if (IS_SYSCONTROL_CMD(syscontrol_cmds[i], op))
        {
            masks[0] = (syscontrol_cmds[i] >> 1) & 1;
            masks[1] = (syscontrol_cmds[i] >> 0) & 1;
            return 1;
        }
    }
    return 0;
}

int gzip_compress(const void* src, const unsigned int src_len, void** dst, unsigned int* dst_len)
{
    size_t dlen;
    z_stream stream;
    unsigned char* ptr;

    dlen = compressBound(src_len) + sizeof(unsigned int);
    ptr = pool_room_alloc(&this.pool, GZIP_ROOM_IDX, dlen);
    if (ptr == NULL) return 0;
    *dst = ptr;
    *(unsigned int*)ptr = htonl(src_len);
    ptr += sizeof(unsigned int);<commit_msg>修正clang编译失败<commit_after>#include <arpa/inet.h>
#include <sys/time.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zlib.h>

#include "common.h"
#include "library.h"
#include "pool.h"

#include "msg.h"

link_t msg_process_handlers;

#define IS_SYSCONTROL_CMD(ch, op) (((ch >> 2) & MSG_OP_MASK) == op)

static unsigned char syscontrol_cmds[] = {
    /* op, request_mask, reply_mask */
    SYSCONTROL_MASK(SYS_LOGIN, 1, 1),
    SYSCONTROL_MASK(SYS_PING,  0, 0),
};

inline static int find_cmd(unsigned char op, unsigned char masks[2])
{
    size_t i;
    for (i = 0; i < sizeof(syscontrol_cmds); ++i)
    {
        if (IS_SYSCONTROL_CMD(syscontrol_cmds[i], op))
        {
            masks[0] = (syscontrol_cmds[i] >> 1) & 1;
            masks[1] = (syscontrol_cmds[i] >> 0) & 1;
            return 1;
        }
    }
    return 0;
}

int gzip_compress(const void* src, const unsigned int src_len, void** dst, unsigned int* dst_len)
{
    size_t dlen;
    z_stream stream;
    unsigned char* ptr;

    dlen = compressBound(src_len) + sizeof(unsigned int);
    ptr = pool_room_alloc(&this.pool, GZIP_ROOM_IDX, dlen);
    if (ptr == NULL) return 0;
    *dst = ptr;
    *(unsigned int*)ptr = htonl(src_len);
    ptr += sizeof(unsigned int);
{'fraction_non_alphanumeric': 0.149195131527287, 'fraction_numerical': 0.012563800549666274, 'mean_word_length': 3.260869565217391, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, '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': '4006501', 'n_tokens_mistral': 1017, 'n_tokens_neox': 1013, 'n_words': 232}