Author: fireball
Date: Wed Aug 6 07:03:34 2008
New Revision: 35144
URL:
http://svn.reactos.org/svn/reactos?rev=35144&view=rev
Log:
- Rename alloc/free to vfalloc/vffree to not conflict with other apps vfatlib links to.
Modified:
trunk/reactos/lib/fslib/vfatlib/check/check.c
trunk/reactos/lib/fslib/vfatlib/check/common.c
trunk/reactos/lib/fslib/vfatlib/check/common.h
trunk/reactos/lib/fslib/vfatlib/check/fat.c
trunk/reactos/lib/fslib/vfatlib/check/file.c
trunk/reactos/lib/fslib/vfatlib/check/io.c
trunk/reactos/lib/fslib/vfatlib/check/lfn.c
Modified: trunk/reactos/lib/fslib/vfatlib/check/check.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/ch…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/check.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/check.c [iso-8859-1] Wed Aug 6 07:03:34 2008
@@ -130,7 +130,7 @@
DIR_ENT *root;
int next_free = 0, scan;
- root = alloc(fs->root_entries*sizeof(DIR_ENT));
+ root = vfalloc(fs->root_entries*sizeof(DIR_ENT));
fs_read(fs->root_start,fs->root_entries*sizeof(DIR_ENT),root);
while (next_free < (int)fs->root_entries)
@@ -151,7 +151,7 @@
if (scan == (int)fs->root_entries) break;
if (++curr_num >= 10000) die("Unable to create unique name");
}
- free(root);
+ vffree(root);
}
++n_files;
return offset;
Modified: trunk/reactos/lib/fslib/vfatlib/check/common.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/co…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/common.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/common.c [iso-8859-1] Wed Aug 6 07:03:34 2008
@@ -44,7 +44,7 @@
}
-void *alloc(int size)
+void *vfalloc(int size)
{
void *ptr;
@@ -61,7 +61,7 @@
return ptr;
}
-void free(void *ptr)
+void vffree(void *ptr)
{
RtlFreeHeap(RtlGetProcessHeap(), 0, ptr);
}
@@ -70,10 +70,10 @@
{
LINK *link;
- link = alloc(sizeof(LINK));
+ link = vfalloc(sizeof(LINK));
link->next = *root;
*root = link;
- return link->data = alloc(size);
+ return link->data = vfalloc(size);
}
@@ -84,8 +84,8 @@
while (*root) {
this = (LINK *) *root;
*root = this->next;
- free(this->data);
- free(this);
+ vffree(this->data);
+ vffree(this);
}
}
Modified: trunk/reactos/lib/fslib/vfatlib/check/common.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/co…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/common.h [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/common.h [iso-8859-1] Wed Aug 6 07:03:34 2008
@@ -17,8 +17,8 @@
/* Like die, but appends an error message according to the state of errno. */
-void *alloc(int size);
-void free(void *ptr);
+void *vfalloc(int size);
+void vffree(void *ptr);
/* mallocs SIZE bytes and returns a pointer to the data. Terminates the program
if malloc fails. */
Modified: trunk/reactos/lib/fslib/vfatlib/check/fat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/fa…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/fat.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/fat.c [iso-8859-1] Wed Aug 6 07:03:34 2008
@@ -55,11 +55,11 @@
if (eff_size % 512) {
eff_size += 512 - (eff_size % 512);
}
- first = alloc(eff_size);
+ first = vfalloc(eff_size);
fs_read(fs->fat_start,eff_size,first);
use = first;
if (fs->nfats > 1) {
- second = alloc(eff_size);
+ second = vfalloc(eff_size);
fs_read(fs->fat_start+fs->fat_size,eff_size,second);
}
else
@@ -106,9 +106,9 @@
i-2,fs->fat[i].value,fs->clusters+2-1);
set_fat(fs,i,-1);
}
- free(first);
+ vffree(first);
if (second)
- free(second);
+ vffree(second);
}
Modified: trunk/reactos/lib/fslib/vfatlib/check/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/fi…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/file.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/file.c [iso-8859-1] Wed Aug 6 07:03:34 2008
@@ -128,7 +128,7 @@
die("Ambiguous name: \"%s\"",path);
else if (here && !strncmp(name,walk->name,MSDOS_NAME)) break;
if (!walk) {
- walk = alloc(sizeof(FDSC));
+ walk = vfalloc(sizeof(FDSC));
strncpy(walk->name,name,MSDOS_NAME);
walk->type = here ? fdt_none : type;
walk->first = NULL;
@@ -203,7 +203,7 @@
die("Internal error: file_modify");
}
next = (*this)->next;
- free(*this);
+ vffree(*this);
*this = next;
}
@@ -218,7 +218,7 @@
else if (this->type != fdt_none)
VfatPrint("Warning: did not %s file %s\n",this->type == fdt_drop ?
"drop" : "undelete",file_name((unsigned char*)this->name));
- free(this);
+ vffree(this);
this = next;
}
}
Modified: trunk/reactos/lib/fslib/vfatlib/check/io.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/io…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/io.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/io.c [iso-8859-1] Wed Aug 6 07:03:34 2008
@@ -86,14 +86,14 @@
const loff_t seekpos_aligned = pos - (pos % 512); // TMN:
const size_t seek_delta = (size_t)(pos - seekpos_aligned); // TMN:
const size_t readsize = (size_t)(pos - seekpos_aligned) + readsize_aligned; // TMN:
- char* tmpBuf = alloc(readsize_aligned); // TMN:
+ char* tmpBuf = vfalloc(readsize_aligned); // TMN:
if (llseek(fd,seekpos_aligned,0) != seekpos_aligned) pdie("Seek to
%I64d",pos);
if ((got = read(fd,tmpBuf,readsize_aligned)) < 0) pdie("Read %d bytes at
%I64d",size,pos);
assert(got >= size);
got = size;
assert(seek_delta + size <= readsize);
memcpy(data, tmpBuf+seek_delta, size);
- free(tmpBuf);
+ vffree(tmpBuf);
#else // TMN:
if (llseek(fd,pos,0) != pos) pdie("Seek to %lld",pos);
if ((got = read(fd,data,size)) < 0) pdie("Read %d bytes at
%lld",size,pos);
@@ -119,15 +119,15 @@
#if 1 // TMN
const size_t readsize_aligned = (size % 512) ? (size + (512 - (size % 512))) : size;
// TMN:
const loff_t seekpos_aligned = pos - (pos % 512); // TMN:
- scratch = alloc(readsize_aligned);
+ scratch = vfalloc(readsize_aligned);
if (llseek(fd,seekpos_aligned,0) != seekpos_aligned) pdie("Seek to
%lld",pos);
okay = read(fd,scratch,readsize_aligned) == (int)readsize_aligned;
- free(scratch);
+ vffree(scratch);
#else // TMN:
if (llseek(fd,pos,0) != pos) pdie("Seek to %lld",pos);
- scratch = alloc(size);
+ scratch = vfalloc(size);
okay = read(fd,scratch,size) == size;
- free(scratch);
+ vffree(scratch);
#endif // TMN:
return okay;
}
@@ -148,7 +148,7 @@
/* Aloc temp buffer if write is not aligned */
if (use_read)
- scratch = alloc(readsize_aligned);
+ scratch = vfalloc(readsize_aligned);
else
scratch = data;
@@ -167,16 +167,16 @@
/* Write it back */
if ((did = write(fd,scratch,readsize_aligned)) == (int)readsize_aligned)
{
- if (use_read) free(scratch);
+ if (use_read) vffree(scratch);
return;
}
if (did < 0) pdie("Write %d bytes at %I64d",size,pos);
die("Wrote %d bytes instead of %d at %I64d",did,size,pos);
}
- new = alloc(sizeof(CHANGE));
+ new = vfalloc(sizeof(CHANGE));
new->pos = pos;
- memcpy(new->data = alloc(new->size = size),data,size);
+ memcpy(new->data = vfalloc(new->size = size),data,size);
new->next = NULL;
if (last) last->next = new;
else changes = new;
@@ -190,9 +190,9 @@
if (did < 0) pdie("Write %d bytes at %lld",size,pos);
die("Wrote %d bytes instead of %d at %lld",did,size,pos);
}
- new = alloc(sizeof(CHANGE));
+ new = vfalloc(sizeof(CHANGE));
new->pos = pos;
- memcpy(new->data = alloc(new->size = size),data,size);
+ memcpy(new->data = vfalloc(new->size = size),data,size);
new->next = NULL;
if (last) last->next = new;
else changes = new;
@@ -215,8 +215,8 @@
fs_write(this->pos, this->size, this->data);
- free(this->data);
- free(this);
+ vffree(this->data);
+ vffree(this);
}
/* Restore values */
@@ -233,8 +233,8 @@
if (write) fs_flush();
else while (changes) {
next = changes->next;
- free(changes->data);
- free(changes);
+ vffree(changes->data);
+ vffree(changes);
changes = next;
}
if (close(fd) < 0) pdie("closing file system");
Modified: trunk/reactos/lib/fslib/vfatlib/check/lfn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/lf…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/lfn.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/lfn.c [iso-8859-1] Wed Aug 6 07:03:34 2008
@@ -81,7 +81,7 @@
else
len += 4;
}
- cp = out = use_q ? qalloc( &mem_queue, len+1 ) : alloc( len+1 );
+ cp = out = use_q ? qalloc( &mem_queue, len+1 ) : vfalloc( len+1 );
for( up = uni; (up-uni)/2 < maxlen && (up[0] || up[1]); up += 2 ) {
if (UNICODE_CONVERTABLE(up[0],up[1]))
@@ -132,10 +132,10 @@
void lfn_reset( void )
{
if (lfn_unicode)
- free( lfn_unicode );
+ vffree( lfn_unicode );
lfn_unicode = NULL;
if (lfn_offsets)
- free( lfn_offsets );
+ vffree( lfn_offsets );
lfn_offsets = NULL;
lfn_slot = -1;
}
@@ -169,8 +169,8 @@
char *part2 = CNV_PARTS_SO_FAR();
VfatPrint( " It could be that the LFN start bit is wrong here\n"
" if \"%s\" seems to match \"%s\".\n", part1, part2 );
- free( part1 );
- free( part2 );
+ vffree( part1 );
+ vffree( part2 );
can_clear = 1;
}
if (interactive) {
@@ -197,8 +197,8 @@
}
lfn_slot = lfn->id & LFN_ID_SLOTMASK;
lfn_checksum = lfn->alias_checksum;
- lfn_unicode = alloc( (lfn_slot*CHARS_PER_LFN+1)*2 );
- lfn_offsets = alloc( lfn_slot*sizeof(loff_t) );
+ lfn_unicode = vfalloc( (lfn_slot*CHARS_PER_LFN+1)*2 );
+ lfn_offsets = vfalloc( lfn_slot*sizeof(loff_t) );
lfn_parts = 0;
}
else if (lfn_slot == -1) {
@@ -219,7 +219,7 @@
switch( get_key( "123", "?" )) {
case '1':
if (!lfn_offsets)
- lfn_offsets = alloc( sizeof(loff_t) );
+ lfn_offsets = vfalloc( sizeof(loff_t) );
lfn_offsets[0] = dir_offset;
clear_lfn_slots( 0, 0 );
lfn_reset();
@@ -233,8 +233,8 @@
sizeof(lfn->id), &lfn->id );
lfn_slot = lfn->id & LFN_ID_SLOTMASK;
lfn_checksum = lfn->alias_checksum;
- lfn_unicode = alloc( (lfn_slot*CHARS_PER_LFN+1)*2 );
- lfn_offsets = alloc( lfn_slot*sizeof(loff_t) );
+ lfn_unicode = vfalloc( (lfn_slot*CHARS_PER_LFN+1)*2 );
+ lfn_offsets = vfalloc( lfn_slot*sizeof(loff_t) );
lfn_parts = 0;
break;
}
@@ -255,8 +255,8 @@
char *part2 = CNV_PARTS_SO_FAR();
VfatPrint( " It could be that just the number is wrong\n"
" if \"%s\" seems to match \"%s\".\n", part1, part2
);
- free( part1 );
- free( part2 );
+ vffree( part1 );
+ vffree( part2 );
can_fix = 1;
}
if (interactive) {
@@ -381,7 +381,7 @@
VfatPrint( "Unfinished long file name \"%s\".\n"
" (Start may have been overwritten by %s)\n",
long_name, short_name );
- free( long_name );
+ vffree( long_name );
if (interactive) {
VfatPrint( "1: Delete LFN\n2: Leave it as it is.\n"
"3: Fix numbering (truncates long name and attaches "
@@ -421,7 +421,7 @@
VfatPrint( "Wrong checksum for long file name \"%s\".\n"
" (Short name %s may have changed without updating the long name)\n",
long_name, short_name );
- free( long_name );
+ vffree( long_name );
if (interactive) {
VfatPrint( "1: Delete LFN\n2: Leave it as it is.\n"
"3: Fix checksum (attaches to short name %s)\n",