Wrap function call pointer calls in (*func) to avoid macros rewriting
open and close. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18551 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 - 2005 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2006 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -51,9 +51,9 @@ DB_close(krb5_context context, HDB *db)
|
|||||||
DB *d = (DB*)db->hdb_db;
|
DB *d = (DB*)db->hdb_db;
|
||||||
DBC *dbcp = (DBC*)db->hdb_dbc;
|
DBC *dbcp = (DBC*)db->hdb_dbc;
|
||||||
|
|
||||||
dbcp->c_close(dbcp);
|
(*dbcp->c_close)(dbcp);
|
||||||
db->hdb_dbc = 0;
|
db->hdb_dbc = 0;
|
||||||
d->close(d, 0);
|
(*d->close)(d, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,10 +100,10 @@ DB_seq(krb5_context context, HDB *db,
|
|||||||
|
|
||||||
memset(&key, 0, sizeof(DBT));
|
memset(&key, 0, sizeof(DBT));
|
||||||
memset(&value, 0, sizeof(DBT));
|
memset(&value, 0, sizeof(DBT));
|
||||||
if (db->hdb_lock(context, db, HDB_RLOCK))
|
if ((*db->hdb_lock)(context, db, HDB_RLOCK))
|
||||||
return HDB_ERR_DB_INUSE;
|
return HDB_ERR_DB_INUSE;
|
||||||
code = dbcp->c_get(dbcp, &key, &value, flag);
|
code = (*dbcp->c_get)(dbcp, &key, &value, flag);
|
||||||
db->hdb_unlock(context, db); /* XXX check value */
|
(*db->hdb_unlock)(context, db); /* XXX check value */
|
||||||
if (code == DB_NOTFOUND)
|
if (code == DB_NOTFOUND)
|
||||||
return HDB_ERR_NOENTRY;
|
return HDB_ERR_NOENTRY;
|
||||||
if (code)
|
if (code)
|
||||||
@@ -179,10 +179,10 @@ DB__get(krb5_context context, HDB *db, krb5_data key, krb5_data *reply)
|
|||||||
k.data = key.data;
|
k.data = key.data;
|
||||||
k.size = key.length;
|
k.size = key.length;
|
||||||
k.flags = 0;
|
k.flags = 0;
|
||||||
if ((code = db->hdb_lock(context, db, HDB_RLOCK)))
|
if ((code = (*db->hdb_lock)(context, db, HDB_RLOCK)))
|
||||||
return code;
|
return code;
|
||||||
code = d->get(d, NULL, &k, &v, 0);
|
code = (*d->get)(d, NULL, &k, &v, 0);
|
||||||
db->hdb_unlock(context, db);
|
(*db->hdb_unlock)(context, db);
|
||||||
if(code == DB_NOTFOUND)
|
if(code == DB_NOTFOUND)
|
||||||
return HDB_ERR_NOENTRY;
|
return HDB_ERR_NOENTRY;
|
||||||
if(code)
|
if(code)
|
||||||
@@ -208,10 +208,10 @@ DB__put(krb5_context context, HDB *db, int replace,
|
|||||||
v.data = value.data;
|
v.data = value.data;
|
||||||
v.size = value.length;
|
v.size = value.length;
|
||||||
v.flags = 0;
|
v.flags = 0;
|
||||||
if ((code = db->hdb_lock(context, db, HDB_WLOCK)))
|
if ((code = (*db->hdb_lock)(context, db, HDB_WLOCK)))
|
||||||
return code;
|
return code;
|
||||||
code = d->put(d, NULL, &k, &v, replace ? 0 : DB_NOOVERWRITE);
|
code = (*d->put)(d, NULL, &k, &v, replace ? 0 : DB_NOOVERWRITE);
|
||||||
db->hdb_unlock(context, db);
|
(*db->hdb_unlock)(context, db);
|
||||||
if(code == DB_KEYEXIST)
|
if(code == DB_KEYEXIST)
|
||||||
return HDB_ERR_EXISTS;
|
return HDB_ERR_EXISTS;
|
||||||
if(code)
|
if(code)
|
||||||
@@ -229,11 +229,11 @@ DB__del(krb5_context context, HDB *db, krb5_data key)
|
|||||||
k.data = key.data;
|
k.data = key.data;
|
||||||
k.size = key.length;
|
k.size = key.length;
|
||||||
k.flags = 0;
|
k.flags = 0;
|
||||||
code = db->hdb_lock(context, db, HDB_WLOCK);
|
code = (*db->hdb_lock)(context, db, HDB_WLOCK);
|
||||||
if(code)
|
if(code)
|
||||||
return code;
|
return code;
|
||||||
code = d->del(d, NULL, &k, 0);
|
code = (*d->del)(d, NULL, &k, 0);
|
||||||
db->hdb_unlock(context, db);
|
(*db->hdb_unlock)(context, db);
|
||||||
if(code == DB_NOTFOUND)
|
if(code == DB_NOTFOUND)
|
||||||
return HDB_ERR_NOENTRY;
|
return HDB_ERR_NOENTRY;
|
||||||
if(code)
|
if(code)
|
||||||
@@ -270,17 +270,19 @@ DB_open(krb5_context context, HDB *db, int flags, mode_t mode)
|
|||||||
db->hdb_db = d;
|
db->hdb_db = d;
|
||||||
|
|
||||||
#if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 1)
|
#if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 1)
|
||||||
ret = d->open(db->hdb_db, NULL, fn, NULL, DB_BTREE, myflags, mode);
|
ret = (*d->open)(db->hdb_db, NULL, fn, NULL, DB_BTREE, myflags, mode);
|
||||||
#else
|
#else
|
||||||
ret = d->open(db->hdb_db, fn, NULL, DB_BTREE, myflags, mode);
|
ret = (*d->open)(db->hdb_db, fn, NULL, DB_BTREE, myflags, mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ret == ENOENT) {
|
if (ret == ENOENT) {
|
||||||
/* try to open without .db extension */
|
/* try to open without .db extension */
|
||||||
#if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 1)
|
#if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 1)
|
||||||
ret = d->open(db->hdb_db, NULL, db->hdb_name, NULL, DB_BTREE, myflags, mode);
|
ret = (*d->open)(db->hdb_db, NULL, db->hdb_name, NULL, DB_BTREE,
|
||||||
|
myflags, mode);
|
||||||
#else
|
#else
|
||||||
ret = d->open(db->hdb_db, db->hdb_name, NULL, DB_BTREE, myflags, mode);
|
ret = (*d->open)(db->hdb_db, db->hdb_name, NULL, DB_BTREE,
|
||||||
|
myflags, mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +294,7 @@ DB_open(krb5_context context, HDB *db, int flags, mode_t mode)
|
|||||||
}
|
}
|
||||||
free(fn);
|
free(fn);
|
||||||
|
|
||||||
ret = d->cursor(d, NULL, (DBC **)&db->hdb_dbc, 0);
|
ret = (*d->cursor)(d, NULL, (DBC **)&db->hdb_dbc, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_set_error_string(context, "d->cursor: %s", strerror(ret));
|
krb5_set_error_string(context, "d->cursor: %s", strerror(ret));
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user