<commit_before>/*
 *  libcucul      Canvas for ultrafast compositing of Unicode letters
 *  Copyright (c) 2002-2006 <NAME> <<EMAIL>>
 *                All Rights Reserved
 *
 *  $Id$
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the Do What The Fuck You Want To
 *  Public License, Version 2, as published by Sam Hocevar. See
 *  http://sam.zoy.org/wtfpl/COPYING for more details.
 */

/*
 *  This file contains buffer handling functions.
 */

#include "config.h"
#include "common.h"

#if !defined(__KERNEL__)
#   include <stdio.h>
#   include <stdlib.h>
#   include <string.h>
#endif

#include "cucul.h"
#include "cucul_internals.h"

/** \brief Load a memory area into a buffer.
 *
 *  Create a \e libcucul buffer that points to the given memory area. The
 *  data is not duplicated and any changes made to the original memory area
 *  will appear in the buffer.
 *
 *  Keep in mind that buffers are not strings. When loading a C string, the
 *  terminating '\0' must not be part of the buffer, hence \e size should
 *  be computed with strlen(). Conversely, the '\0' is not appended to
 *  exported buffers even when they could be parsed as strings.
 *
 *  \param data The memory area to load.
 *  \param size The size of the memory area.
 *  \return A \e libcucul buffer pointing to the memory area, or NULL
 *          if an error occurred.
 */
cucul_buffer_t *cucul_load_memory(void *data, unsigned long int size)
{
    cucul_buffer_t *buf;

    buf = malloc(sizeof(cucul_buffer_t));
    if(!buf)
        return NULL;
<commit_msg>  * Minor syntax fix in the doxygen documentation.<commit_after>/*
 *  libcucul      Canvas for ultrafast compositing of Unicode letters
 *  Copyright (c) 2002-2006 <NAME> <<EMAIL>>
 *                All Rights Reserved
 *
 *  $Id$
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the Do What The Fuck You Want To
 *  Public License, Version 2, as published by Sam Hocevar. See
 *  http://sam.zoy.org/wtfpl/COPYING for more details.
 */

/*
 *  This file contains buffer handling functions.
 */

#include "config.h"
#include "common.h"

#if !defined(__KERNEL__)
#   include <stdio.h>
#   include <stdlib.h>
#   include <string.h>
#endif

#include "cucul.h"
#include "cucul_internals.h"

/** \brief Load a memory area into a buffer.
 *
 *  Create a \e libcucul buffer that points to the given memory area. The
 *  data is not duplicated and any changes made to the original memory area
 *  will appear in the buffer.
 *
 *  Keep in mind that buffers are not strings. When loading a C string, the
 *  terminating '\\0' must not be part of the buffer, hence \e size should
 *  be computed with strlen(). Conversely, the '\\0' is not appended to
 *  exported buffers even when they could be parsed as strings.
 *
 *  \param data The memory area to load.
 *  \param size The size of the memory area.
 *  \return A \e libcucul buffer pointing to the memory area, or NULL
 *          if an error occurred.
 */
cucul_buffer_t *cucul_load_memory(void *data, unsigned long int size)
{
    cucul_buffer_t *buf;

    buf = malloc(sizeof(cucul_buffer_t));
    if(!buf)
        return NULL;

{'fraction_non_alphanumeric': 0.09127600124185035, 'fraction_numerical': 0.006830176963675877, 'mean_word_length': 3.012453300124533, 'pattern_counts': {'":': 0, '<': 15, '<?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': '1300821', 'n_tokens_mistral': 1034, 'n_tokens_neox': 989, 'n_words': 429}