Hubbub $Id$
utils.h
Go to the documentation of this file.
1/*
2 * This file is part of Hubbub.
3 * Licensed under the MIT License,
4 * http://www.opensource.org/licenses/mit-license.php
5 * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
6 */
7
8#ifndef hubbub_utils_h_
9#define hubbub_utils_h_
10
11#ifndef max
12#define max(a,b) ((a)>(b)?(a):(b))
13#endif
14
15#ifndef min
16#define min(a,b) ((a)<(b)?(a):(b))
17#endif
18
19#ifndef SLEN
20/* Calculate length of a string constant */
21#define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */
22#endif
23
24#ifndef UNUSED
25#define UNUSED(x) ((void)(x))
26#endif
27
28/* Useful for iterating over arrays */
29#define N_ELEMENTS(x) sizeof((x)) / sizeof((x)[0])
30
31#endif