~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_cache.c

Removed/replaced DBUG symbols and TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
          this, just remember the file name for later removal
27
27
        */
28
28
 
29
 
static bool cache_remove_open_tmp(IO_CACHE *cache __attribute__((unused)),
 
29
static my_bool cache_remove_open_tmp(IO_CACHE *cache __attribute__((unused)),
30
30
                                     const char *name)
31
31
{
32
32
#if O_TEMPORARY == 0
57
57
        ** If dir is not given, use TMPDIR.
58
58
        */
59
59
 
60
 
bool open_cached_file(IO_CACHE *cache, const char* dir, const char *prefix,
 
60
my_bool open_cached_file(IO_CACHE *cache, const char* dir, const char *prefix,
61
61
                         size_t cache_size, myf cache_myflags)
62
62
{
 
63
  DBUG_ENTER("open_cached_file");
63
64
  cache->dir=    dir ? my_strdup(dir,MYF(cache_myflags & MY_WME)) : (char*) 0;
64
65
  cache->prefix= (prefix ? my_strdup(prefix,MYF(cache_myflags & MY_WME)) :
65
66
                 (char*) 0);
68
69
  if (!init_io_cache(cache,-1,cache_size,WRITE_CACHE,0L,0,
69
70
                     MYF(cache_myflags | MY_NABP)))
70
71
  {
71
 
    return(0);
 
72
    DBUG_RETURN(0);
72
73
  }
73
74
  my_free(cache->dir,   MYF(MY_ALLOW_ZERO_PTR));
74
75
  my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR));
75
 
  return(1);
 
76
  DBUG_RETURN(1);
76
77
}
77
78
 
78
79
        /* Create the temporary file */
79
80
 
80
 
bool real_open_cached_file(IO_CACHE *cache)
 
81
my_bool real_open_cached_file(IO_CACHE *cache)
81
82
{
82
83
  char name_buff[FN_REFLEN];
83
84
  int error=1;
 
85
  DBUG_ENTER("real_open_cached_file");
84
86
  if ((cache->file=create_temp_file(name_buff, cache->dir, cache->prefix,
85
87
                                    (O_RDWR | O_BINARY | O_TRUNC |
86
88
                                     O_TEMPORARY | O_SHORT_LIVED),
89
91
    error=0;
90
92
    cache_remove_open_tmp(cache, name_buff);
91
93
  }
92
 
  return(error);
 
94
  DBUG_RETURN(error);
93
95
}
94
96
 
95
97
 
96
98
void close_cached_file(IO_CACHE *cache)
97
99
{
 
100
  DBUG_ENTER("close_cached_file");
98
101
  if (my_b_inited(cache))
99
102
  {
100
103
    File file=cache->file;
114
117
    my_free(cache->dir,MYF(MY_ALLOW_ZERO_PTR));
115
118
    my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR));
116
119
  }
117
 
  return;
 
120
  DBUG_VOID_RETURN;
118
121
}