DUMB SHIT MISCHIEF AND MALFEASANCE EDITION – Telegram
DUMB SHIT MISCHIEF AND MALFEASANCE EDITION
99 subscribers
2.53K photos
2.09K videos
15 files
137 links
Download Telegram
I should remove xalloc functions from my code already. Error checking sucks but it sucks less than having the program exit "randomly"

// The code, if you were wondering

#define XALLOC_EXIT(msg, ...) do {\
if(!___VXGG___XALLOC_EXIT_ON_ERROR___)\
abort();\
if(!___VXGG___VERBOSE_ERRORS___)\
exit(EXIT_FAILURE);\
error(EXIT_FAILURE, errno, (msg)__VA_ARGS__);\
exit(EXIT_FAILURE); /* Makes gcc happy */\
} while (0)

enum XALLOC_TYPE {
XALLOC_INVAL, // Default when unset

XALLOC_MALLOC,
XALLOC_CALLOC,
XALLOC_REALLOC,

XALLOC_2BIG // Out of range
};

void * xalloc(size_t nmemb, size_t size, enum XALLOC_TYPE actype, void *ptr) {
if(actype <= XALLOC_INVAL || actype >= XALLOC_2BIG)
RETURNWERR(EINVAL, NULL);

void *mem = NULL;
switch(actype) {
case XALLOC_MALLOC:
mem = malloc(nmemb * size);
break;

case XALLOC_CALLOC:
mem = calloc(nmemb, size);
break;

case XALLOC_REALLOC:
mem = realloc(ptr, nmemb * size);
break;

default:
XALLOC_EXIT("<xalloc> An unknown alloc type was passed, which shouldn't be possible", );
}

if(!mem)
XALLOC_EXIT("<xalloc> Could not allocate memory", );

return mem;
}

void * xmalloc(size_t size) {
return xalloc(size, 1, XALLOC_MALLOC, NULL);
}

void * xcalloc(size_t nmemb, size_t size) {
return xalloc(nmemb, size, XALLOC_CALLOC, NULL);
}

void * xreallocarray(void *ptr, size_t nmemb, size_t size) {
return xalloc(nmemb, size, XALLOC_REALLOC, ptr);
}
I want to do this now
Forwarded from The Goon Cave (scoot jockey (ban me if you're gay))
This media is not supported in your browser
VIEW IN TELEGRAM
Tactical diddy deployed, bro got a gay hitman on speed dial🤣🤣😭💀💀💀💀
Forwarded from /g/‘s Tech Memes
First and last posts of 4chan

There's a similar energy here that really does feel prophetic.