<commit_before>/*
 * Copyright (C) 2014-2015 <NAME>. All rights reserved.
 * Author: <NAME> <<EMAIL>>
 *
 * Provided under the three clause BSD license found in the LICENSE file.
 */

#include <stdint.h>
#include <asm/spinlock.h>

static struct spinlock malloc_spinlock = SPINLOCK_INIT(malloc_spinlock);

ssize_t low_write(char *buffer, int count);
int low_getchar(bool wait);

uint32_t _sbrk(int incr)
{
    extern uint32_t _sheap;
    static uint32_t s_heap_end;
    uint32_t new_heap_space;

    if (!s_heap_end)
        s_heap_end = (uint32_t) &_sheap;

    new_heap_space = s_heap_end;
    s_heap_end += incr;
    return new_heap_space;
}

void __malloc_lock(struct _reent *reent)
{
    spinlock_lock(&malloc_spinlock);
}

void __malloc_unlock(struct _reent *reent)
{
    spinlock_unlock(&malloc_spinlock);
}<commit_msg>libc: add support for assert<commit_after>/*
 * Copyright (C) 2014-2015 <NAME>. All rights reserved.
 * Author: <NAME> <<EMAIL>>
 *
 * Provided under the three clause BSD license found in the LICENSE file.
 */

#include <stdint.h>
#include <asm/spinlock.h>

static struct spinlock malloc_spinlock = SPINLOCK_INIT(malloc_spinlock);

ssize_t low_write(char *buffer, int count);
int low_getchar(bool wait);

uint32_t _sbrk(int incr)
{
    extern uint32_t _sheap;
    static uint32_t s_heap_end;
    uint32_t new_heap_space;

    if (!s_heap_end)
        s_heap_end = (uint32_t) &_sheap;

    new_heap_space = s_heap_end;
    s_heap_end += incr;
    return new_heap_space;
}

void __malloc_lock(struct _reent *reent)
{
    spinlock_lock(&malloc_spinlock);
}

void __malloc_unlock(struct _reent *reent)
{
    spinlock_unlock(&malloc_spinlock);
}

int _getpid(void)
{
    return 1;
}

int _kill(int pid, int sig)
{
    return 0;
}

void _exit(int code)
{
    while (1);
}
{'fraction_non_alphanumeric': 0.10670391061452514, 'fraction_numerical': 0.021787709497206705, 'mean_word_length': 4.176300578034682, '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': '4700149', 'n_tokens_mistral': 713, 'n_tokens_neox': 678, 'n_words': 164}