pointer.h

Sat, 14 May 2005 22:23:20 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sat, 14 May 2005 22:23:20 +0200
changeset 100
8ae0f0aa5a16
parent 89
17a16ed84bbf
permissions
-rw-r--r--

Added some coercions to remove gcc complaints in snprintf_2.2.

89
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
1 /*
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
2 * libtu/pointer.h
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
3 *
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
4 * Copyright (c) Tuomo Valkonen 2005.
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
5 *
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
6 * You may distribute and modify this library under the terms of either
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
8 */
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
9
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
10 #ifndef LIBTU_POINTER_H
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
11 #define LIBTU_POINTER_H
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
12
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
13 #define FIELD_OFFSET(T, F) ((long)((char*)&((T*)0)->F))
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
14 #define FIELD_TO_STRUCT(T, F, A) ((T*)(((char*)A)-FIELD_OFFSET(T, F)))
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
15
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
16 #endif /* LIBTU_POINTER_H */

mercurial