view src/lib/safe-memset.c @ 21390:2e2563132d5f

Updated copyright notices to include the year 2017.
author Stephan Bosch <stephan.bosch@dovecot.fi>
date Wed, 11 Jan 2017 02:51:13 +0100
parents 0f22db71df7a
children cb108f786fb4
line wrap: on
line source

/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "safe-memset.h"

void safe_memset(void *data, int c, size_t size)
{
	volatile unsigned int volatile_zero_idx = 0;
	volatile unsigned char *p = data;

	if (size == 0)
		return;

	do {
		memset(data, c, size);
	} while (p[volatile_zero_idx] != c);
}