Add casts to tools/makedep.c
Gerald Pfeifer
gerald at pfeifer.com
Mon Mar 12 02:34:17 CDT 2007
I accidently ended up building Wine using a C++ compiler the other day,
and came across the following.
Gerald
ChangeLog:
Cast the results of xmalloc() and xrealloc() properly.
Index: makedep.c
===================================================================
RCS file: /home/wine/wine/tools/makedep.c,v
retrieving revision 1.31
diff -u -3 -p -r1.31 makedep.c
--- makedep.c 1 Mar 2007 22:28:09 -0000 1.31
+++ makedep.c 12 Mar 2007 07:27:20 -0000
@@ -139,7 +139,7 @@ static char *strmake( const char* fmt, .
for (;;)
{
- char *p = xmalloc (size);
+ char *p = (char*) xmalloc (size);
va_start(ap, fmt);
n = vsnprintf (p, size, fmt, ap);
va_end(ap);
@@ -184,7 +184,7 @@ static char *get_line( FILE *file )
if (!size)
{
size = 1024;
- buffer = xmalloc( size );
+ buffer = (char*) xmalloc( size );
}
if (!fgets( buffer, size, file )) return NULL;
input_line++;
@@ -195,7 +195,7 @@ static char *get_line( FILE *file )
/* if line is larger than buffer, resize buffer */
while (p == buffer + size - 1 && p[-1] != '\n')
{
- buffer = xrealloc( buffer, size * 2 );
+ buffer = (char*) xrealloc( buffer, size * 2 );
fgets( buffer + size - 1, size + 1, file );
p = buffer + strlen(buffer);
size *= 2;
@@ -224,7 +224,7 @@ static char *get_line( FILE *file )
*/
static void add_include_path( const char *name )
{
- INCL_PATH *path = xmalloc( sizeof(*path) );
+ INCL_PATH *path = (INCL_PATH*) xmalloc( sizeof(*path) );
list_add_tail( &paths, &path->entry );
path->name = name;
}
@@ -251,7 +251,7 @@ static INCL_FILE *add_src_file( const ch
INCL_FILE *file;
if (find_src_file( name )) return NULL; /* we already have it */
- file = xmalloc( sizeof(*file) );
+ file = (INCL_FILE*) xmalloc( sizeof(*file) );
memset( file, 0, sizeof(*file) );
file->name = xstrdup(name);
list_add_tail( &sources, &file->entry );
@@ -308,7 +308,7 @@ static INCL_FILE *add_include( INCL_FILE
LIST_FOR_EACH_ENTRY( include, &includes, INCL_FILE, entry )
if (!strcmp( name, include->name )) goto found;
- include = xmalloc( sizeof(INCL_FILE) );
+ include = (INCL_FILE*) xmalloc( sizeof(INCL_FILE) );
memset( include, 0, sizeof(INCL_FILE) );
include->name = xstrdup(name);
include->included_by = pFile;
@@ -484,7 +484,7 @@ static FILE *open_include_file( INCL_FIL
if ((p = strrchr(pFile->included_by->filename, '/')))
{
int l = p - pFile->included_by->filename + 1;
- filename = xmalloc(l + strlen(pFile->name) + 1);
+ filename = (char*) xmalloc(l + strlen(pFile->name) + 1);
memcpy( filename, pFile->included_by->filename, l );
strcpy( filename + l, pFile->name );
if ((file = fopen( filename, "r" ))) goto found;
More information about the wine-patches
mailing list