Revision 7267c094 block/vvfat.c
b/block/vvfat.c | ||
---|---|---|
101 | 101 |
{ |
102 | 102 |
if((index + 1) * array->item_size > array->size) { |
103 | 103 |
int new_size = (index + 32) * array->item_size; |
104 |
array->pointer = qemu_realloc(array->pointer, new_size);
|
|
104 |
array->pointer = g_realloc(array->pointer, new_size);
|
|
105 | 105 |
if (!array->pointer) |
106 | 106 |
return -1; |
107 | 107 |
array->size = new_size; |
... | ... | |
127 | 127 |
static inline void* array_insert(array_t* array,unsigned int index,unsigned int count) { |
128 | 128 |
if((array->next+count)*array->item_size>array->size) { |
129 | 129 |
int increment=count*array->item_size; |
130 |
array->pointer=qemu_realloc(array->pointer,array->size+increment);
|
|
130 |
array->pointer=g_realloc(array->pointer,array->size+increment);
|
|
131 | 131 |
if(!array->pointer) |
132 | 132 |
return NULL; |
133 | 133 |
array->size+=increment; |
... | ... | |
159 | 159 |
is=array->item_size; |
160 | 160 |
from=array->pointer+index_from*is; |
161 | 161 |
to=array->pointer+index_to*is; |
162 |
buf=qemu_malloc(is*count);
|
|
162 |
buf=g_malloc(is*count);
|
|
163 | 163 |
memcpy(buf,from,is*count); |
164 | 164 |
|
165 | 165 |
if(index_to<index_from) |
... | ... | |
728 | 728 |
if(first_cluster == 0 && (is_dotdot || is_dot)) |
729 | 729 |
continue; |
730 | 730 |
|
731 |
buffer=(char*)qemu_malloc(length);
|
|
731 |
buffer=(char*)g_malloc(length);
|
|
732 | 732 |
snprintf(buffer,length,"%s/%s",dirname,entry->d_name); |
733 | 733 |
|
734 | 734 |
if(stat(buffer,&st)<0) { |
... | ... | |
850 | 850 |
memset(&(s->first_sectors[0]),0,0x40*0x200); |
851 | 851 |
|
852 | 852 |
s->cluster_size=s->sectors_per_cluster*0x200; |
853 |
s->cluster_buffer=qemu_malloc(s->cluster_size);
|
|
853 |
s->cluster_buffer=g_malloc(s->cluster_size);
|
|
854 | 854 |
|
855 | 855 |
/* |
856 | 856 |
* The formula: sc = spf+1+spf*spc*(512*8/fat_type), |
... | ... | |
884 | 884 |
mapping->dir_index = 0; |
885 | 885 |
mapping->info.dir.parent_mapping_index = -1; |
886 | 886 |
mapping->first_mapping_index = -1; |
887 |
mapping->path = qemu_strdup(dirname);
|
|
887 |
mapping->path = g_strdup(dirname);
|
|
888 | 888 |
i = strlen(mapping->path); |
889 | 889 |
if (i > 0 && mapping->path[i - 1] == '/') |
890 | 890 |
mapping->path[i - 1] = '\0'; |
... | ... | |
1638 | 1638 |
|
1639 | 1639 |
/* rename */ |
1640 | 1640 |
if (strcmp(basename, basename2)) |
1641 |
schedule_rename(s, cluster_num, qemu_strdup(path));
|
|
1641 |
schedule_rename(s, cluster_num, g_strdup(path));
|
|
1642 | 1642 |
} else if (is_file(direntry)) |
1643 | 1643 |
/* new file */ |
1644 |
schedule_new_file(s, qemu_strdup(path), cluster_num);
|
|
1644 |
schedule_new_file(s, g_strdup(path), cluster_num);
|
|
1645 | 1645 |
else { |
1646 | 1646 |
abort(); |
1647 | 1647 |
return 0; |
... | ... | |
1735 | 1735 |
int cluster_num, const char* path) |
1736 | 1736 |
{ |
1737 | 1737 |
int ret = 0; |
1738 |
unsigned char* cluster = qemu_malloc(s->cluster_size);
|
|
1738 |
unsigned char* cluster = g_malloc(s->cluster_size);
|
|
1739 | 1739 |
direntry_t* direntries = (direntry_t*)cluster; |
1740 | 1740 |
mapping_t* mapping = find_mapping_for_cluster(s, cluster_num); |
1741 | 1741 |
|
... | ... | |
1758 | 1758 |
mapping->mode &= ~MODE_DELETED; |
1759 | 1759 |
|
1760 | 1760 |
if (strcmp(basename, basename2)) |
1761 |
schedule_rename(s, cluster_num, qemu_strdup(path));
|
|
1761 |
schedule_rename(s, cluster_num, g_strdup(path));
|
|
1762 | 1762 |
} else |
1763 | 1763 |
/* new directory */ |
1764 |
schedule_mkdir(s, cluster_num, qemu_strdup(path));
|
|
1764 |
schedule_mkdir(s, cluster_num, g_strdup(path));
|
|
1765 | 1765 |
|
1766 | 1766 |
lfn_init(&lfn); |
1767 | 1767 |
do { |
... | ... | |
1876 | 1876 |
*/ |
1877 | 1877 |
if (s->fat2 == NULL) { |
1878 | 1878 |
int size = 0x200 * s->sectors_per_fat; |
1879 |
s->fat2 = qemu_malloc(size);
|
|
1879 |
s->fat2 = g_malloc(size);
|
|
1880 | 1880 |
memcpy(s->fat2, s->fat.pointer, size); |
1881 | 1881 |
} |
1882 | 1882 |
check = vvfat_read(s->bs, |
... | ... | |
2218 | 2218 |
uint32_t first_cluster = c; |
2219 | 2219 |
mapping_t* mapping = find_mapping_for_cluster(s, c); |
2220 | 2220 |
uint32_t size = filesize_of_direntry(direntry); |
2221 |
char* cluster = qemu_malloc(s->cluster_size);
|
|
2221 |
char* cluster = g_malloc(s->cluster_size);
|
|
2222 | 2222 |
uint32_t i; |
2223 | 2223 |
int fd = 0; |
2224 | 2224 |
|
... | ... | |
2383 | 2383 |
mapping_t* m = find_mapping_for_cluster(s, |
2384 | 2384 |
begin_of_direntry(d)); |
2385 | 2385 |
int l = strlen(m->path); |
2386 |
char* new_path = qemu_malloc(l + diff + 1);
|
|
2386 |
char* new_path = g_malloc(l + diff + 1);
|
|
2387 | 2387 |
|
2388 | 2388 |
assert(!strncmp(m->path, mapping->path, l2)); |
2389 | 2389 |
|
... | ... | |
2794 | 2794 |
|
2795 | 2795 |
array_init(&(s->commits), sizeof(commit_t)); |
2796 | 2796 |
|
2797 |
s->qcow_filename = qemu_malloc(1024);
|
|
2797 |
s->qcow_filename = g_malloc(1024);
|
|
2798 | 2798 |
get_tmp_filename(s->qcow_filename, 1024); |
2799 | 2799 |
|
2800 | 2800 |
bdrv_qcow = bdrv_find_format("qcow"); |
... | ... | |
2822 | 2822 |
|
2823 | 2823 |
s->bs->backing_hd = calloc(sizeof(BlockDriverState), 1); |
2824 | 2824 |
s->bs->backing_hd->drv = &vvfat_write_target; |
2825 |
s->bs->backing_hd->opaque = qemu_malloc(sizeof(void*));
|
|
2825 |
s->bs->backing_hd->opaque = g_malloc(sizeof(void*));
|
|
2826 | 2826 |
*(void**)s->bs->backing_hd->opaque = s; |
2827 | 2827 |
|
2828 | 2828 |
return 0; |
Also available in: Unified diff