~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_cache.c

  • Committer: Brian Aker
  • Date: 2008-07-18 20:10:26 UTC
  • mfrom: (51.3.29 remove-dbug)
  • Revision ID: brian@tangent.org-20080718201026-tto5golt0xhwqe4a
Merging in Jay's final patch on dbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
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");
64
63
  cache->dir=    dir ? my_strdup(dir,MYF(cache_myflags & MY_WME)) : (char*) 0;
65
64
  cache->prefix= (prefix ? my_strdup(prefix,MYF(cache_myflags & MY_WME)) :
66
65
                 (char*) 0);
69
68
  if (!init_io_cache(cache,-1,cache_size,WRITE_CACHE,0L,0,
70
69
                     MYF(cache_myflags | MY_NABP)))
71
70
  {
72
 
    DBUG_RETURN(0);
 
71
    return(0);
73
72
  }
74
73
  my_free(cache->dir,   MYF(MY_ALLOW_ZERO_PTR));
75
74
  my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR));
76
 
  DBUG_RETURN(1);
 
75
  return(1);
77
76
}
78
77
 
79
78
        /* Create the temporary file */
82
81
{
83
82
  char name_buff[FN_REFLEN];
84
83
  int error=1;
85
 
  DBUG_ENTER("real_open_cached_file");
86
84
  if ((cache->file=create_temp_file(name_buff, cache->dir, cache->prefix,
87
85
                                    (O_RDWR | O_BINARY | O_TRUNC |
88
86
                                     O_TEMPORARY | O_SHORT_LIVED),
91
89
    error=0;
92
90
    cache_remove_open_tmp(cache, name_buff);
93
91
  }
94
 
  DBUG_RETURN(error);
 
92
  return(error);
95
93
}
96
94
 
97
95
 
98
96
void close_cached_file(IO_CACHE *cache)
99
97
{
100
 
  DBUG_ENTER("close_cached_file");
101
98
  if (my_b_inited(cache))
102
99
  {
103
100
    File file=cache->file;
117
114
    my_free(cache->dir,MYF(MY_ALLOW_ZERO_PTR));
118
115
    my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR));
119
116
  }
120
 
  DBUG_VOID_RETURN;
 
117
  return;
121
118
}