chiark / gitweb /
Quieten over-pick compiler.
[disorder] / lib / table.h
index 476399d60e2083693d3c91ea473a9f9683ec7c74..8cdfcfd985707602cfae7c7cc292dcebef9e5042 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder
- * Copyright (C) 2004, 2005 Richard Kettlewell
+ * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #ifndef TABLE_H
 #define TABLE_H
 
-#define TABLE_FIND(TABLE, TYPE, FIELD, NAME)   \
-  table_find((void *)TABLE,                    \
-            offsetof(TYPE, FIELD),             \
-            sizeof (TYPE),                     \
-            sizeof TABLE / sizeof (TYPE),      \
+#define TABLE_FIND(TABLE, FIELD, NAME)                 \
+  table_find((void *)TABLE,                            \
+            offsetof(typeof((TABLE)[0]), FIELD),       \
+            sizeof ((TABLE)[0]),                       \
+            sizeof TABLE / sizeof ((TABLE)[0]),        \
             NAME)
-/* Search TYPE TABLE[] for an element where TABLE[N].FIELD matches NAME
+/* Search TABLE[] for an element where TABLE[N].FIELD matches NAME
  * Returns the index N on success or -1 if not found
  * The table must be lexically sorted on FIELD
  */
@@ -43,4 +43,3 @@ c-basic-offset:2
 comment-column:40
 End:
 */
-/* arch-tag:15b07f98a592f80e4e22dd3f213f2580 */