From: Ben Pfaff Date: Tue, 9 Jun 2009 05:19:33 +0000 (-0700) Subject: table: Replace macros by inline functions, to improve type safety. X-Git-Tag: v0.7.3~48 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36b2d5046477c00e7a2e3faf7ff64e04ff65b879;p=pspp-builds.git table: Replace macros by inline functions, to improve type safety. --- diff --git a/src/output/table.h b/src/output/table.h index 2777c59d..567745d4 100644 --- a/src/output/table.h +++ b/src/output/table.h @@ -101,23 +101,15 @@ struct tab_table int col_ofs, row_ofs; /* X and Y offsets. */ }; -/* Number of rows in TABLE. */ -#define tab_nr(TABLE) ((TABLE)->nr) - -/* Number of columns in TABLE. */ -#define tab_nc(TABLE) ((TABLE)->nc) - -/* Number of left header columns in TABLE. */ -#define tab_l(TABLE) ((TABLE)->l) - -/* Number of right header columns in TABLE. */ -#define tab_r(TABLE) ((TABLE)->r) - -/* Number of top header rows in TABLE. */ -#define tab_t(TABLE) ((TABLE)->t) - -/* Number of bottom header rows in TABLE. */ -#define tab_b(TABLE) ((TABLE)->b) +/* Number of rows or columns in TABLE. */ +static inline int tab_nr (const struct tab_table *table) { return table->nr; } +static inline int tab_nc (const struct tab_table *table) { return table->nc; } + +/* Number of left/right/top/bottom header columns/rows in TABLE. */ +static inline int tab_l (const struct tab_table *table) { return table->l; } +static inline int tab_r (const struct tab_table *table) { return table->r; } +static inline int tab_t (const struct tab_table *table) { return table->t; } +static inline int tab_b (const struct tab_table *table) { return table->b; } /* Tables. */ struct tab_table *tab_create (int nc, int nr, int reallocable);