<commit_before>/*
 * plat_posix.h
 *
 * Copyright (c) 2005, 2006, 2008, 2012
 *      libchewing Core Team. See ChangeLog for details.
 *
 * See the file "COPYING" for information on usage and redistribution
 * of this file.
 */

#ifndef PLAT_POSIX_H
#    define PLAT_POSIX_H

#    ifdef UNDER_POSIX

#        include <unistd.h>
#        include <sys/types.h>
#        include <sys/stat.h>
#        include <fcntl.h>
#        include <limits.h>

#        include <sys/types.h>

#        define PLAT_SEPARATOR "/"
#        define PLAT_TMPDIR "/tmp"
#        define PLAT_MKDIR(dir) \
	mkdir(dir, S_IRWXU)
#        define PLAT_RENAME(oldpath, newpath) \
	rename(oldpath, newpath)
#        define PLAT_UNLINK(path) \
	unlink(path)

/* GNU Hurd doesn't define PATH_MAX */
#        ifndef PATH_MAX
#            define PATH_MAX 4096
#        endif

#        ifdef __cplusplus
extern "C" {
#        endif                  /* __cplusplus */

/* plat_mmap.h */
    typedef struct plat_mmap {
        int fd;
        void *address;
        size_t sizet;
        int fAccessAttr;
    } plat_mmap;

#        ifdef __cplusplus<commit_msg>Print error message when PLAT_RENAME fails<commit_after>/*
 * plat_posix.h
 *
 * Copyright (c) 2005, 2006, 2008, 2012
 *      libchewing Core Team. See ChangeLog for details.
 *
 * See the file "COPYING" for information on usage and redistribution
 * of this file.
 */

#ifndef PLAT_POSIX_H
#    define PLAT_POSIX_H

#    ifdef UNDER_POSIX

#        include <unistd.h>
#        include <sys/types.h>
#        include <sys/stat.h>
#        include <fcntl.h>
#        include <limits.h>

#        include <sys/types.h>
#        include <errno.h>

#        define PLAT_SEPARATOR "/"
#        define PLAT_TMPDIR "/tmp"
#        define PLAT_MKDIR(dir) \
	mkdir(dir, S_IRWXU)
#        define PLAT_RENAME(oldpath, newpath) do { \
             int ret = rename(oldpath, newpath); \
             if (ret == -1) { \
                 LOG_ERROR("rename fails. errno = %d", errno); \
             } \
         } while (0)

#        define PLAT_UNLINK(path) \
	unlink(path)

/* GNU Hurd doesn't define PATH_MAX */
#        ifndef PATH_MAX
#            define PATH_MAX 4096
#        endif

#        ifdef __cplusplus
extern "C" {
#        endif                  /* __cplusplus */

/* plat_mmap.h */
    typedef struct plat_mmap {
        int fd;
        void *address;
        size_t sizet;
        int fAccessAttr;
    } plat_mmap;

#        ifdef __cplusplus
{'fraction_non_alphanumeric': 0.1053484602917342, 'fraction_numerical': 0.017017828200972446, 'mean_word_length': 1.8843457943925233, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '5439812', 'n_tokens_mistral': 926, 'n_tokens_neox': 848, 'n_words': 209}