-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.h
41 lines (33 loc) · 830 Bytes
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
/**
* @file util.h
* @brief Some tool tools/functions
*
* @author Valérian Rousset
*/
#include <stddef.h> // for size_t
/**
* @brief tag a variable as POTENTIALLY unused, to avoid compiler warnings
*/
#define _unused __attribute__((unused))
/**
* @brief useful to free pointers to const without warning. Use with care!
*/
#define free_const_ptr(X) free((void*)X)
/**
* @brief create a new copy of a string
* @param str string to be copied
* @return the newly allocated copy
*/
char *strdup(const char *str);
/**
* @brief computes actual number of arguments
* @param pointer to argument array
* @return the number of non NULL arguments after (and including) argv
*/
size_t argv_size(char **argv);
/**
* @brief prints sha
* @param hash code to print
*/
void print_sha(unsigned char* hash);