~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_cache.cc

  • Committer: Monty Taylor
  • Date: 2008-12-09 04:45:44 UTC
  • mto: This revision was merged to the branch mainline in revision 670.
  • Revision ID: monty@inaugust.com-20081209044544-va4o2vmn3xuao22y
Added more return value checks.

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
        */
36
36
  cache->dir=    dir ? strdup(dir) : (char*) 0;
37
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 */