00001 00007 /* 00008 * Copyright 2009 Red Hat Inc., Durham, North Carolina. 00009 * All Rights Reserved. 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Lesser General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2.1 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 * 00025 * Authors: 00026 * "Daniel Kopecek" <dkopecek@redhat.com> 00027 */ 00028 00029 #pragma once 00030 #ifndef ENCACHE_H 00031 #define ENCACHE_H 00032 00033 #include <pthread.h> 00034 #include <stdint.h> 00035 00036 #define ENCACHE_INIT_SIZE 24 00037 #define ENCACHE_ADD_SIZE 8 00038 00043 typedef struct { 00044 pthread_rwlock_t lock; 00045 SEXP_t **name; 00046 size_t real; 00047 size_t size; 00048 } encache_t; 00049 00054 encache_t *encache_new (void); 00055 00064 void encache_free (encache_t *cache); 00065 00075 SEXP_t *encache_add (encache_t *cache, const char *name); 00076 00085 SEXP_t *encache_get (encache_t *cache, const char *name); 00086 00095 SEXP_t *encache_ref (encache_t *cache, const char *name); 00096 00097 #endif /* ENCACHE_H */