data_structures
Functions
utils.h File Reference
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
+ Include dependency graph for utils.h:

Go to the source code of this file.

Functions

void ds_bzero (void *s, size_t n)
 Replicates behaviour of bzero from libc. More...
 
size_t ds_strlen (const char *s)
 Replicates behaviour of strlen from libc. More...
 
int ds_strcmp (const char *s1, const char *s2)
 Replicates strcmp from libc. More...
 
void * ds_xcalloc (size_t count, size_t size)
 Replicates behaviour of calloc from libc, but fails on memory allocation errors. More...
 
void * ds_xmalloc (size_t size)
 Replicates behaviour of malloc from libc, but fails on memory allocation errors. More...
 
char * ds_strdup (const char *s1)
 Replicates behaviour of strdup from libc. More...
 
void ds_exit (void)
 Print the error message, corresponding to errno, exit the process. More...
 
void ds_exit_set (int err)
 Set errno to the specified value, print the error message, and exit the process. More...
 

Function Documentation

◆ ds_bzero()

void ds_bzero ( void *  s,
size_t  n 
)

Replicates behaviour of bzero from libc.

Definition at line 20 of file ds_bzero.c.

◆ ds_exit()

void ds_exit ( void  )

Print the error message, corresponding to errno, exit the process.

Definition at line 20 of file ds_exit.c.

◆ ds_exit_set()

void ds_exit_set ( int  err)

Set errno to the specified value, print the error message, and exit the process.

Parameters
errThe value to which set errno

Definition at line 22 of file ds_exit_set.c.

◆ ds_strcmp()

int ds_strcmp ( const char *  s1,
const char *  s2 
)

Replicates strcmp from libc.

Definition at line 20 of file ds_strcmp.c.

◆ ds_strdup()

char* ds_strdup ( const char *  s1)

Replicates behaviour of strdup from libc.

Definition at line 20 of file ds_strdup.c.

◆ ds_strlen()

size_t ds_strlen ( const char *  s)

Replicates behaviour of strlen from libc.

Definition at line 20 of file ds_strlen.c.

◆ ds_xcalloc()

void* ds_xcalloc ( size_t  count,
size_t  size 
)

Replicates behaviour of calloc from libc, but fails on memory allocation errors.

Definition at line 22 of file ds_xcalloc.c.

◆ ds_xmalloc()

void* ds_xmalloc ( size_t  size)

Replicates behaviour of malloc from libc, but fails on memory allocation errors.

Definition at line 22 of file ds_xmalloc.c.