Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devmanu-de/xmemtools


https://github.com/devmanu-de/xmemtools

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# xmemtools
xmemtools provides safer alternatives to memory functions like `malloc`

## Description

### xmalloc
allocates a block of memory and ruturns a pointer to it.

### xcalloc
allocates a block of memory and sets it to 0 and returns a pointer to it.

### xrealloc
reallocates a allocated block and returns a pointer to it.

### xfree
frees an allocated block of memory.

### xmemdup
douplicates a block of memory and returns a pointer to the allocated block.

All functions `assert` if allocation failed.

### xstrdiff
compares 2 strings and returns a pointer to the first different char in s1.

## Usage

All functions behave like their `stdlib.h` functions just that these add some safety.