Back to index

courier  0.68.2
Functions
bdbobj3.c File Reference
#include "config.h"
#include <string.h>
#include <stdlib.h>
#include "bdbobj.h"

Go to the source code of this file.

Functions

int bdbobj_delete (struct bdbobj *obj, const char *key, size_t keylen)

Function Documentation

int bdbobj_delete ( struct bdbobj obj,
const char *  key,
size_t  keylen 
)

Definition at line 11 of file bdbobj3.c.

{
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);
}