wpp: Get rid of wpp_parse_temp, temp file management is better left to callers.
This commit is contained in:
parent
4d55592540
commit
bd94f95938
|
@ -57,7 +57,6 @@ extern void wpp_set_pedantic( int on );
|
|||
extern int wpp_add_include_path( const char *path );
|
||||
extern char *wpp_find_include( const char *name, const char *parent_name );
|
||||
extern int wpp_parse( const char *input, FILE *output );
|
||||
extern int wpp_parse_temp( const char *input, const char *output_base, char **output_name );
|
||||
extern void wpp_set_callbacks( const struct wpp_callbacks *callbacks );
|
||||
|
||||
#endif /* __WINE_WPP_H */
|
||||
|
|
|
@ -203,43 +203,6 @@ int wpp_parse( const char *input, FILE *output )
|
|||
}
|
||||
|
||||
|
||||
/* parse into a temporary file */
|
||||
int wpp_parse_temp( const char *input, const char *output_base, char **output_name )
|
||||
{
|
||||
FILE *output;
|
||||
int ret, fd;
|
||||
char *temp_name;
|
||||
|
||||
if (!output_base || !output_base[0]) output_base = "wpptmp";
|
||||
|
||||
temp_name = pp_xmalloc( strlen(output_base) + 8 );
|
||||
if(!temp_name)
|
||||
return 1;
|
||||
strcpy( temp_name, output_base );
|
||||
strcat( temp_name, ".XXXXXX" );
|
||||
|
||||
if((fd = mkstemps( temp_name, 0 )) == -1)
|
||||
{
|
||||
ppy_error("Could not generate a temp name from %s\n", temp_name);
|
||||
free( temp_name );
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (!(output = fdopen(fd, "wt")))
|
||||
{
|
||||
ppy_error("Could not open fd %s for writing\n", temp_name);
|
||||
close( fd );
|
||||
unlink( temp_name );
|
||||
free( temp_name );
|
||||
return 2;
|
||||
}
|
||||
|
||||
*output_name = temp_name;
|
||||
ret = wpp_parse( input, output );
|
||||
fclose( output );
|
||||
return ret;
|
||||
}
|
||||
|
||||
void wpp_set_callbacks( const struct wpp_callbacks *callbacks )
|
||||
{
|
||||
wpp_callbacks = callbacks;
|
||||
|
|
Loading…
Reference in New Issue