Download
20 lines 409 BCModified 2020-09-03 raw
1234567891011121314151617181920
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define startswith(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
#define xwrite(fd, s) write(fd, s, strlen(s))

static inline void assert(int cond, const char *msg)
{
    if (!cond) {
        perror(msg);
        _exit(1);
    }
}

static inline void *memcheck(void *p)
{
    assert(p != NULL, "Memory allocation error");
    return p;
}