view src/lib/lib.c @ 9191:b340ecb24469 HEAD

Fix VPATH build of RQUOTA support. Some rpcgen derive #include "..." paths from the infile argument. This will be off for VPATH builds, as the generated rquota_xdr.c code will look in $(srcdir), but we'll generate the rquota.h file in $(builddir). Play safe and copy rquota.x to $(builddir) first. This fixes the build on openSUSE 11.1.
author Matthias Andree <>
date Tue, 07 Jul 2009 21:01:36 +0200
parents b9faf4db2a9f
children 19d851d93f92
line wrap: on
line source

/* Copyright (c) 2001-2009 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "hostpid.h"

#include <stdlib.h>
#include <time.h>

size_t nearest_power(size_t num)
	size_t n = 1;

	i_assert(num <= ((size_t)1 << (BITS_IN_SIZE_T-1)));

	while (n < num) n <<= 1;
	return n;

void lib_init(void)
	/* standard way to get rand() return different values. */
	srand((unsigned int) time(NULL));


void lib_deinit(void)