From d31084e9d1118b25fd16580d9d8c2924b5740dff Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Tue, 9 Jul 1996 06:22:35 +0000 Subject: Postgres95 1.01 Distribution - Virgin Sources --- src/backend/utils/init/enbl.c | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/backend/utils/init/enbl.c (limited to 'src/backend/utils/init/enbl.c') diff --git a/src/backend/utils/init/enbl.c b/src/backend/utils/init/enbl.c new file mode 100644 index 0000000000..995ab9d956 --- /dev/null +++ b/src/backend/utils/init/enbl.c @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * enbl.c-- + * POSTGRES module enable and disable support code. + * + * Copyright (c) 1994, Regents of the University of California + * + * + * IDENTIFICATION + * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/enbl.c,v 1.1.1.1 1996/07/09 06:22:08 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#include "c.h" +#include "utils/module.h" /* where the declarations go */ + +/* + * BypassEnable -- + * False iff enable/disable processing is required given on and "*countP." + * + * Note: + * As a side-effect, *countP is modified. It should be 0 initially. + * + * Exceptions: + * BadState if called with pointer to value 0 and false. + * BadArg if "countP" is invalid pointer. + * BadArg if on is invalid. + */ +bool +BypassEnable(int *enableCountInOutP, bool on) +{ + AssertArg(PointerIsValid(enableCountInOutP)); + AssertArg(BoolIsValid(on)); + + if (on) { + *enableCountInOutP += 1; + return ((bool)(*enableCountInOutP >= 2)); + } + + AssertState(*enableCountInOutP >= 1); + + *enableCountInOutP -= 1; + + return ((bool)(*enableCountInOutP >= 1)); +} -- cgit v1.2.1