comparison src/audacious/vfs_buffered_file.c @ 2589:ea470384e752 trunk

[svn] - add vfs_buffered_file_release_live_fd().
author nenolod
date Tue, 27 Feb 2007 04:09:06 -0800
parents c51a5a735f65
children 06e4bbdb6c45
comparison
equal deleted inserted replaced
2588:c51a5a735f65 2589:ea470384e752
36 36
37 if (file->handle) 37 if (file->handle)
38 { 38 {
39 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; 39 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle;
40 40
41 vfs_fclose(handle->fd); 41 if (handle->fd != NULL)
42 vfs_fclose(handle->fd);
43
42 vfs_fclose(handle->buffer); 44 vfs_fclose(handle->buffer);
43 g_free(handle->mem); 45 g_free(handle->mem);
44 g_free(handle); 46 g_free(handle);
45 } 47 }
46 48
220 handle->ref = 1; 222 handle->ref = 1;
221 223
222 return handle; 224 return handle;
223 } 225 }
224 226
227 VFSFile *
228 vfs_buffered_file_release_live_fd(VFSFile *fd)
229 {
230 VFSBufferedFile *file = (VFSBufferedFile *) fd;
231 VFSFile *out;
232
233 g_return_val_if_fail(file != NULL, NULL);
234
235 out = file->fd;
236 file->fd = NULL;
237
238 vfs_fclose(fd);
239
240 return out;
241 }