Changes by: szaka
Update of /cvs/linux-ntfs/ntfsprogs/ntfsprogs
In directory delta357.server4you.de:/tmp/cvs-serv24690
Modified Files:
ntfsresize.c utils.c
Log Message:
convert all malloc,calloc to ntfs_{malloc,calloc}
Index: ntfsresize.c
===================================================================
RCS file: /cvs/linux-ntfs/ntfsprogs/ntfsprogs/ntfsresize.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -p -r1.118 -r1.119
--- ntfsresize.c 18 Apr 2006 22:03:09 -0000 1.118
+++ ntfsresize.c 13 Aug 2006 16:06:57 -0000 1.119
@@ -1203,8 +1203,9 @@ static void replace_attribute_runlist(nt
a->length += l;
}
- if (!(mp = calloc(1, mp_size)))
- perr_exit("Couldn't get memory");
+ mp = ntfs_calloc(mp_size);
+ if (!mp)
+ perr_exit("ntfsc_calloc couldn't get memory");
if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl, 0, NULL))
perr_exit("ntfs_mapping_pairs_build");
@@ -1468,8 +1469,9 @@ static void rl_split_run(runlist **rl, i
size_head = run * sizeof(runlist_element);
size_tail = (items - run - 1) * sizeof(runlist_element);
- if (!(rl_new = (runlist *)malloc(new_size)))
- perr_exit("malloc");
+ rl_new = ntfs_malloc(new_size);
+ if (!rl_new)
+ perr_exit("ntfs_malloc");
rle_new = rl_new + run;
rle = *rl + run;
@@ -1719,9 +1721,9 @@ static void relocate_inodes(ntfs_resize_
progress_init(&resize->progress, 0, resize->relocations, resize->progress.flags);
resize->relocations = 0;
- resize->mrec = (MFT_RECORD *)malloc(resize->vol->mft_record_size);
+ resize->mrec = ntfs_malloc(resize->vol->mft_record_size);
if (!resize->mrec)
- perr_exit("malloc failed");
+ perr_exit("ntfs_malloc failed");
nr_mft_records = resize->vol->mft_na->initialized_size >>
resize->vol->mft_record_size_bits;
@@ -2119,7 +2121,8 @@ static int setup_lcn_bitmap(struct bitma
/* Determine lcn bitmap byte size and allocate it. */
bm->size = rounded_up_division(nr_clusters, 8);
- if (!(bm->bm = (unsigned char *)calloc(1, bm->size)))
+ bm->bm = ntfs_calloc(bm->size);
+ if (!bm->bm)
return -1;
bitmap_file_data_fixup(nr_clusters, bm);
Index: utils.c
===================================================================
RCS file: /cvs/linux-ntfs/ntfsprogs/ntfsprogs/utils.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -p -r1.64 -r1.65
--- utils.c 17 Jul 2006 11:49:52 -0000 1.64
+++ utils.c 13 Aug 2006 16:06:57 -0000 1.65
@@ -421,7 +421,7 @@ int utils_inode_get_name(ntfs_inode *ino
FILE_NAME_ATTR *attr;
int name_space;
MFT_REF parent = FILE_root;
- char *names[max_path + 1];// XXX malloc? and make max bigger?
+ char *names[max_path + 1];// XXX ntfs_malloc? and make max bigger?
int i, len, offset = 0;
if (!inode || !buffer) {
@@ -465,7 +465,7 @@ int utils_inode_get_name(ntfs_inode *ino
&names[i], 0) < 0) {
char *temp;
ntfs_log_error("Couldn't translate filename to current locale.\n");
- temp = malloc(30);
+ temp = ntfs_malloc(30);
if (!temp)
return 0;
snprintf(temp, 30, "<MFT%llu>", (unsigned
@@ -965,10 +965,9 @@ int mft_next_record(struct mft_search_ct
ctx->inode->mft_no = ctx->mft_num;
ctx->inode->vol = ctx->vol;
- ctx->inode->mrec = malloc(ctx->vol->mft_record_size);
+ ctx->inode->mrec = ntfs_malloc(ctx->vol->mft_record_size);
if (!ctx->inode->mrec) {
free(ctx->inode); // == ntfs_inode_close
- ntfs_log_error("Out of memory. Aborting.\n");
return -1;
}
|