aboutsummaryrefslogtreecommitdiff
path: root/src/misc.h
blob: c97a59e9369b2edf9bea4af8b58b17db0868c0a8 (plain)
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
/**
 * @file misc.h
 * @author Joe Wingbermuehle
 * @date 2004-2006
 *
 * @brief Miscellaneous functions and macros.
 *
 */

#ifndef MISC_H
#define MISC_H

/** Return the minimum of two values. */
#define Min( x, y ) ( (x) > (y) ? (y) : (x) )

/** Return the maximum of two values. */
#define Max( x, y ) ( (x) > (y) ? (x) : (y) )

/** Perform shell-like macro path expansion.
 * @param path The path to expand (possibly reallocated).
 */
void ExpandPath(char **path);

/** Trim leading and trailing whitespace from a string.
 * @param str The string to trim.
 */
void Trim(char *str);

/** Copy a string.
 * Note that NULL is accepted. When provided NULL, NULL will be returned.
 * @param str The string to copy.
 * @return A copy of the string.
 */
char *CopyString(const char *str);

#endif