/*
 * enbl.c --
 *	POSTGRES module enable and disable support code.
 */

#include "tmp/c.h"

RcsId("$Header: /private/postgres/src/utils/init/RCS/enbl.c,v 1.3 1990/09/25 16:52:55 kemnitz Exp $");

#include "utils/module.h"

bool
BypassEnable(enableCountInOutP, on)
	Count	*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));
}
