~jaypipes/drizzle/new-test-runner

« back to all changes in this revision

Viewing changes to mysys/mf_cache.cc

  • Committer: Jay Pipes
  • Date: 2008-12-11 17:52:34 UTC
  • mfrom: (482.16.152 testable)
  • Revision ID: jpipes@serialcoder-20081211175234-uqsfvmgxejvmellq
merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        /*
26
26
        ** Open tempfile cached by IO_CACHE
27
27
        ** Should be used when no seeks are done (only reinit_io_buff)
28
 
        ** Return 0 if cache is inited ok
 
28
        ** Return false if cache is inited ok
29
29
        ** The actual file is created when the IO_CACHE buffer gets filled
30
30
        ** If dir is not given, use TMPDIR.
31
31
        */
33
33
bool open_cached_file(IO_CACHE *cache, const char* dir, const char *prefix,
34
34
                         size_t cache_size, myf cache_myflags)
35
35
{
36
 
  cache->dir=    dir ? my_strdup(dir,MYF(cache_myflags & MY_WME)) : (char*) 0;
37
 
  cache->prefix= (prefix ? my_strdup(prefix,MYF(cache_myflags & MY_WME)) :
 
36
  cache->dir=    dir ? strdup(dir) : (char*) 0;
 
37
  cache->prefix= (prefix ? strdup(prefix) :
38
38
                 (char*) 0);
 
39
  if ((cache->dir == NULL) || (cache->prefix == NULL))
 
40
    return true;
39
41
  cache->file_name=0;
40
42
  cache->buffer=0;                              /* Mark that not open */
41
43
  if (!init_io_cache(cache,-1,cache_size,WRITE_CACHE,0L,0,
42
44
                     MYF(cache_myflags | MY_NABP)))
43
45
  {
44
 
    return(0);
 
46
    return false;
45
47
  }
46
48
  free(cache->dir);
47
49
  free(cache->prefix);
48
 
  return(1);
 
50
  return true;
49
51
}
50
52
 
51
53
        /* Create the temporary file */