Lines Matching defs:cache

257 /** \brief Find an option in an option cache with the name as key */
259 findOption(const driOptionCache *cache, const char *name)
262 uint32_t size = 1 << cache->tableSize, mask = size - 1;
270 hash = (hash >> (16-cache->tableSize/2)) & mask;
275 if (cache->info[hash].name == NULL)
277 else if (!strcmp(name, cache->info[hash].name))
594 driOptionCache *cache;
810 driOptionCache *cache = data->cache;
811 uint32_t opt = findOption(cache, name);
812 if (cache->info[opt].name == NULL)
816 else if (getenv(cache->info[opt].name)) {
821 cache->info[opt].name);
823 } else if (!parseValue(&cache->values[opt], cache->info[opt].type, value))
1143 /** \brief Initialize an option cache based on info */
1145 initOptionCache(driOptionCache *cache, const driOptionCache *info)
1148 cache->info = info->info;
1149 cache->tableSize = info->tableSize;
1150 cache->values = malloc(((size_t)1 << info->tableSize) * sizeof(driOptionValue));
1151 if (cache->values == NULL) {
1155 memcpy(cache->values, info->values,
1158 if (cache->info[i].type == DRI_STRING)
1159 XSTRDUP(cache->values[i]._string, info->values[i]._string);
1187 driParseConfigFiles(driOptionCache *cache, const driOptionCache *info,
1194 initOptionCache(cache, info);
1197 userData.cache = cache;
1241 driDestroyOptionCache(driOptionCache *cache)
1243 if (cache->info) {
1244 unsigned i, size = 1 << cache->tableSize;
1246 if (cache->info[i].type == DRI_STRING)
1247 free(cache->values[i]._string);
1250 free(cache->values);
1254 driCheckOption(const driOptionCache *cache, const char *name,
1257 uint32_t i = findOption(cache, name);
1258 return cache->info[i].name != NULL && cache->info[i].type == type;
1262 driQueryOptionb(const driOptionCache *cache, const char *name)
1264 uint32_t i = findOption(cache, name);
1266 assert(cache->info[i].name != NULL);
1267 assert(cache->info[i].type == DRI_BOOL);
1268 return cache->values[i]._bool;
1272 driQueryOptioni(const driOptionCache *cache, const char *name)
1274 uint32_t i = findOption(cache, name);
1276 assert(cache->info[i].name != NULL);
1277 assert(cache->info[i].type == DRI_INT || cache->info[i].type == DRI_ENUM);
1278 return cache->values[i]._int;
1282 driQueryOptionf(const driOptionCache *cache, const char *name)
1284 uint32_t i = findOption(cache, name);
1286 assert(cache->info[i].name != NULL);
1287 assert(cache->info[i].type == DRI_FLOAT);
1288 return cache->values[i]._float;
1292 driQueryOptionstr(const driOptionCache *cache, const char *name)
1294 uint32_t i = findOption(cache, name);
1296 assert(cache->info[i].name != NULL);
1297 assert(cache->info[i].type == DRI_STRING);
1298 return cache->values[i]._string;