[BusyBox] Re: More on bb_xfopen vs bb_wfopen

Rob Landley rob at landley.net
Mon Sep 29 12:34:32 UTC 2003


On Monday 29 September 2003 08:09, Tito wrote:
> seems to me the major diff is in the bb_error_msg_and_die call.

Yup. I figured that out about thirty seconds after posting, of course.  (The 
perils of late-night coding...)

> Maybe they could be unified as:
>
> FILE *bb_xwfopen(int die, const char *path, const char *mode)
> {
> 	FILE *fp;
> 	if ((fp = fopen(path, mode)) == NULL)
> 	{
> 		bb_perror_msg("%s", path);
> 		errno = 0;
> 		if(die==1)
> 			exit(EXIT_FAILURE)
> 	}
> 	return fp;
> }

This would not necessarily be smaller.  You're adding extra an extra parameter 
to all the code that calls these functions, and that can add up...

Rob



More information about the busybox mailing list