Lines Matching refs:cache
197 #define load_cache(cache, string) &my_cache argument
205 same_cache2(CACHE * cache, const char *string, unsigned i_len) in same_cache2() argument
210 if (cache->s_len == 0 in same_cache2()
211 || cache->s_len < s_len in same_cache2()
212 || cache->list == 0 in same_cache2()
213 || !SAME_CACHE(cache, string, (size_t) s_len)) { in same_cache2()
216 if (cache->list == 0) { in same_cache2()
217 cache->list = dlg_malloc(int, need); in same_cache2()
218 } else if (cache->i_len < i_len) { in same_cache2()
219 cache->list = dlg_realloc(int, need, cache->list); in same_cache2()
221 assert_ptr(cache->list, "load_cache"); in same_cache2()
222 cache->i_len = i_len; in same_cache2()
224 if (cache->s_len >= s_len && cache->string != 0) { in same_cache2()
225 strcpy(cache->string, string); in same_cache2()
227 if (cache->string != 0) in same_cache2()
228 free(cache->string); in same_cache2()
229 cache->string = dlg_strclone(string); in same_cache2()
231 cache->s_len = s_len; in same_cache2()
244 same_cache1(CACHE * cache, const char *string, size_t i_len) in same_cache1() argument
249 if (cache->s_len != s_len in same_cache1()
250 || !SAME_CACHE(cache, string, (size_t) s_len)) { in same_cache1()
252 if (cache->s_len >= s_len && cache->string != 0) { in same_cache1()
253 strcpy(cache->string, string); in same_cache1()
255 if (cache->string != 0) in same_cache1()
256 free(cache->string); in same_cache1()
257 cache->string = dlg_strclone(string); in same_cache1()
259 cache->s_len = s_len; in same_cache1()
260 cache->i_len = i_len; in same_cache1()
279 CACHE *cache = load_cache(cCntWideBytes, string); in dlg_count_wcbytes() local
280 if (!same_cache1(cache, string, len)) { in dlg_count_wcbytes()
283 const char *src = cache->string; in dlg_count_wcbytes()
285 char save = cache->string[len]; in dlg_count_wcbytes()
287 cache->string[len] = '\0'; in dlg_count_wcbytes()
290 cache->string[len] = save; in dlg_count_wcbytes()
296 cache->i_len = len; in dlg_count_wcbytes()
298 result = (int) cache->i_len; in dlg_count_wcbytes()
317 CACHE *cache = load_cache(cCntWideChars, string); in dlg_count_wchars() local
319 if (!same_cache1(cache, string, len)) { in dlg_count_wchars()
320 const char *src = cache->string; in dlg_count_wchars()
322 int part = dlg_count_wcbytes(cache->string, len); in dlg_count_wchars()
323 char save = cache->string[part]; in dlg_count_wchars()
329 cache->string[part] = '\0'; in dlg_count_wchars()
332 cache->i_len = ((int) code >= 0) ? wcslen(temp) : 0; in dlg_count_wchars()
333 cache->string[part] = save; in dlg_count_wchars()
336 cache->i_len = 0; in dlg_count_wchars()
339 result = (int) cache->i_len; in dlg_count_wchars()
356 CACHE *cache = load_cache(cInxWideChars, string); in dlg_index_wchars() local
358 if (!same_cache2(cache, string, len)) { in dlg_index_wchars()
362 cache->list[0] = 0; in dlg_index_wchars()
373 cache->list[inx] = cache->list[inx - 1] + width; in dlg_index_wchars()
378 cache->list[inx] = (int) inx; in dlg_index_wchars()
382 return cache->list; in dlg_index_wchars()
410 CACHE *cache = load_cache(cInxCols, string); in dlg_index_columns() local
412 if (!same_cache2(cache, string, len)) { in dlg_index_columns()
414 cache->list[0] = 0; in dlg_index_columns()
426 result = ((cache->list[inx] | 7) + 1) - cache->list[inx]; in dlg_index_columns()
450 cache->list[inx + 1] = result; in dlg_index_columns()
452 cache->list[inx + 1] += cache->list[inx]; in dlg_index_columns()
463 cache->list[inx + 1] = in dlg_index_columns()
464 ((cache->list[inx] | 7) + 1) - cache->list[inx]; in dlg_index_columns()
466 cache->list[inx + 1] = 1; in dlg_index_columns()
470 cache->list[inx + 1] = (printable in dlg_index_columns()
475 cache->list[inx + 1] += cache->list[inx]; in dlg_index_columns()
479 return cache->list; in dlg_index_columns()