File: bdbobj3.c

package info (click to toggle)
maildrop 2.9.3-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,104 kB
  • sloc: ansic: 26,822; cpp: 9,085; sh: 4,868; makefile: 753; perl: 94
file content (28 lines) | stat: -rw-r--r-- 581 bytes parent folder | download | duplicates (22)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
** distribution information.
*/

#include	"config.h"
#include	<string.h>
#include	<stdlib.h>
#include	"bdbobj.h"

int	bdbobj_delete(struct bdbobj *obj, const char *key, size_t keylen)
{
DBT	dkey, val;

	if (!obj->has_dbf)	return (0);

	memset(&dkey, 0, sizeof(dkey));
	memset(&val, 0, sizeof(val));
	dkey.data=(void *)key;
	dkey.size=keylen;

#if	DB_VERSION_MAJOR < 2
	if ( (*obj->dbf->del)(obj->dbf, &dkey, 0))	return (-1);
#else
	if ( (*obj->dbf->del)(obj->dbf, 0, &dkey, 0))	return (-1);
#endif
	return (0);
}