aboutsummaryrefslogblamecommitdiff
path: root/lib/include/common.h
blob: d006d71df805cf300aa471d3c6c5ce4e66a709f5 (plain) (tree)
1
2
3
4
5
6
7




                                     

                     





                                                                         
               


                                       

                                               
// Copyright (c) 2020 Johannes Stoelp

#pragma once

#include "io.h"
#include "syscalls.h"

#define ERROR_ON(cond, fmt, ...)                                        \
    do {                                                                \
        if ((cond)) {                                                   \
            efmt("%s:%d " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__); \
            _exit(1);                                                   \
        }                                                               \
    } while (0)


void* memset(void* s, int c, size_t n);
void* memcpy(void* d, const void* s, size_t n);