/** * dso.c * * Copyright (C) 2005, 2006 Bojan Smojver, Rexursive * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 2.1 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "private.h" /* DSO utility functions */ apr_status_t rxv_spin_dso_load(rxv_spin_ctx_t *ctx,const char *path, apr_dso_handle_t **handle){ apr_status_t rv; apr_hash_t *dso; apr_pool_t *pool; if(!(ctx && path)) return APR_EGENERAL; if(!ctx->priv) return APR_EGENERAL; dso=ctx->priv->dso; pool=ctx->priv->pool; if(!(*handle=apr_hash_get(dso,path,APR_HASH_KEY_STRING))){ /* no luck, load new one */ if((rv=apr_dso_load(handle,path,pool))!=APR_SUCCESS) return rv; apr_hash_set(dso,apr_pstrdup(pool,path),APR_HASH_KEY_STRING,*handle); } return APR_SUCCESS; }