Commit 201aa35d authored by Tom Lane's avatar Tom Lane

gcc did not like new pg_stat macros, for good and sufficient reason.

Add 'do { ... } while (0)' decoration to eliminate compiler warnings.
parent b6f75fe7
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 2001, PostgreSQL Global Development Group * Copyright (c) 2001, PostgreSQL Global Development Group
* *
* $Id: pgstat.h,v 1.2 2001/06/29 16:29:37 wieck Exp $ * $Id: pgstat.h,v 1.3 2001/06/29 23:03:02 tgl Exp $
* ---------- * ----------
*/ */
#ifndef PGSTAT_H #ifndef PGSTAT_H
...@@ -349,42 +349,61 @@ extern void pgstat_initstats(PgStat_Info *stats, Relation rel); ...@@ -349,42 +349,61 @@ extern void pgstat_initstats(PgStat_Info *stats, Relation rel);
#define pgstat_reset_heap_scan(s) \ #define pgstat_reset_heap_scan(s) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
(s)->heap_scan_counted = FALSE (s)->heap_scan_counted = FALSE; \
} while (0)
#define pgstat_count_heap_scan(s) \ #define pgstat_count_heap_scan(s) \
do { \
if ((s)->tabentry != NULL && !(s)->heap_scan_counted) { \ if ((s)->tabentry != NULL && !(s)->heap_scan_counted) { \
((PgStat_TableEntry *)((s)->tabentry))->t_numscans++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_numscans++; \
(s)->heap_scan_counted = TRUE; \ (s)->heap_scan_counted = TRUE; \
} } \
} while (0)
#define pgstat_count_heap_getnext(s) \ #define pgstat_count_heap_getnext(s) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++ ((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++; \
} while (0)
#define pgstat_count_heap_fetch(s) \ #define pgstat_count_heap_fetch(s) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_tuples_fetched++ ((PgStat_TableEntry *)((s)->tabentry))->t_tuples_fetched++; \
} while (0)
#define pgstat_count_heap_insert(s) \ #define pgstat_count_heap_insert(s) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_tuples_inserted++ ((PgStat_TableEntry *)((s)->tabentry))->t_tuples_inserted++; \
} while (0)
#define pgstat_count_heap_update(s) \ #define pgstat_count_heap_update(s) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_tuples_updated++ ((PgStat_TableEntry *)((s)->tabentry))->t_tuples_updated++; \
} while (0)
#define pgstat_count_heap_delete(s) \ #define pgstat_count_heap_delete(s) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_tuples_deleted++ ((PgStat_TableEntry *)((s)->tabentry))->t_tuples_deleted++; \
} while (0)
#define pgstat_reset_index_scan(s) \ #define pgstat_reset_index_scan(s) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
(s)->index_scan_counted = FALSE (s)->index_scan_counted = FALSE; \
} while (0)
#define pgstat_count_index_scan(s) \ #define pgstat_count_index_scan(s) \
do { \
if ((s)->tabentry != NULL && !(s)->index_scan_counted) { \ if ((s)->tabentry != NULL && !(s)->index_scan_counted) { \
((PgStat_TableEntry *)((s)->tabentry))->t_numscans++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_numscans++; \
(s)->index_scan_counted = TRUE; \ (s)->index_scan_counted = TRUE; \
} } \
} while (0)
#define pgstat_count_index_getnext(s) \ #define pgstat_count_index_getnext(s) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++ ((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++; \
} while (0)
#define pgstat_count_buffer_read(s,r) \ #define pgstat_count_buffer_read(s,r) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \
else { \ else { \
...@@ -393,8 +412,10 @@ extern void pgstat_initstats(PgStat_Info *stats, Relation rel); ...@@ -393,8 +412,10 @@ extern void pgstat_initstats(PgStat_Info *stats, Relation rel);
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \
} \ } \
} } \
} while (0)
#define pgstat_count_buffer_hit(s,r) \ #define pgstat_count_buffer_hit(s,r) \
do { \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \
else { \ else { \
...@@ -403,7 +424,8 @@ extern void pgstat_initstats(PgStat_Info *stats, Relation rel); ...@@ -403,7 +424,8 @@ extern void pgstat_initstats(PgStat_Info *stats, Relation rel);
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \
} \ } \
} } \
} while (0)
extern void pgstat_count_xact_commit(void); extern void pgstat_count_xact_commit(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment