2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
15 * Take a copy of the user's data, if a callback is supplied.
17 * PUBLIC: int __dbt_usercopy __P((ENV *, DBT *));
20 __dbt_usercopy(env, dbt)
27 if (dbt == NULL || !F_ISSET(dbt, DB_DBT_USERCOPY) || dbt->size == 0 ||
32 if ((ret = __os_umalloc(env, dbt->size, &buf)) != 0 ||
33 (ret = env->dbt_usercopy(dbt, 0, buf, dbt->size,
34 DB_USERCOPY_GETDATA)) != 0)
40 err: if (buf != NULL) {
50 * Free a copy of the user's data, if necessary.
52 * PUBLIC: void __dbt_userfree __P((ENV *, DBT *, DBT *, DBT *));
55 __dbt_userfree(env, key, pkey, data)
57 DBT *key, *pkey, *data;
60 F_ISSET(key, DB_DBT_USERCOPY) && key->data != NULL) {
61 __os_ufree(env, key->data);
65 F_ISSET(pkey, DB_DBT_USERCOPY) && pkey->data != NULL) {
66 __os_ufree(env, pkey->data);
70 F_ISSET(data, DB_DBT_USERCOPY) && data->data != NULL) {
71 __os_ufree(env, data->data);