data_structures
utils.h
Go to the documentation of this file.
1 /* ************************************************************************** */
3 /* */
4 /* ::: :::::::: */
5 /* utils.h :+: :+: :+: */
6 /* +:+ +:+ +:+ */
7 /* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8 /* +#+#+#+#+#+ +#+ */
9 /* Created: 2020/07/19 01:53:35 by unite #+# #+# */
10 /* Updated: 2020/09/07 22:44:35 by unite ### ########.fr */
11 /* */
12 /* ************************************************************************** */
13 
14 #ifndef UTILS_H
15 
16 # define UTILS_H
17 
18 # include <string.h>
19 # include <stdlib.h>
20 # include <stdio.h>
21 # include <errno.h>
22 
23 void ds_bzero(void *s, size_t n);
24 size_t ds_strlen(const char *s);
25 int ds_strcmp(const char *s1, const char *s2);
26 void *ds_xcalloc(size_t count, size_t size);
27 void *ds_xmalloc(size_t size);
28 char *ds_strdup(const char *s1);
29 void ds_exit(void);
30 void ds_exit_set(int err);
31 
32 #endif
ds_strlen
size_t ds_strlen(const char *s)
Replicates behaviour of strlen from libc.
Definition: ds_strlen.c:20
ds_exit_set
void ds_exit_set(int err)
Set errno to the specified value, print the error message, and exit the process.
Definition: ds_exit_set.c:22
ds_strdup
char * ds_strdup(const char *s1)
Replicates behaviour of strdup from libc.
Definition: ds_strdup.c:20
ds_xcalloc
void * ds_xcalloc(size_t count, size_t size)
Replicates behaviour of calloc from libc, but fails on memory allocation errors.
Definition: ds_xcalloc.c:22
ds_exit
void ds_exit(void)
Print the error message, corresponding to errno, exit the process.
Definition: ds_exit.c:20
ds_strcmp
int ds_strcmp(const char *s1, const char *s2)
Replicates strcmp from libc.
Definition: ds_strcmp.c:20
ds_xmalloc
void * ds_xmalloc(size_t size)
Replicates behaviour of malloc from libc, but fails on memory allocation errors.
Definition: ds_xmalloc.c:22
ds_bzero
void ds_bzero(void *s, size_t n)
Replicates behaviour of bzero from libc.
Definition: ds_bzero.c:20