1
0
mirror of http://mpg123.de/trunk/.git synced 2025-07-31 13:24:22 +03:00

Added ereturn macro for the frequent

if(some_error_condition)
{
	error("blablabla");
	return error;
}



git-svn-id: svn://scm.orgis.org/mpg123/trunk@1118 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
thor
2007-11-20 20:24:26 +00:00
parent b3fe5d2c4e
commit f7c09a055f
2 changed files with 28 additions and 3 deletions

View File

@ -38,7 +38,7 @@ print "#else\n";
printdefs(0);
print "#endif\n";
for('warning', 'error')
for('warning', 'error', 'ereturn')
{
print "\n/* $_ macros also here... */\n";
printdefs(1, $_);
@ -50,14 +50,21 @@ sub printdefs
my $type = shift;
$type = 'debug' unless defined $type;
my $i;
my $pre = ''; my $post = ''; my $rv = '';
if($type eq 'ereturn')
{
$pre = 'do{ ';
$post = '; return rv; }while(0)';
$rv = 'rv, ';
}
while(++$i <= $num+1)
{
my @args, my $j;
while(++$j < $i){ push(@args, chr(ord('a')+$j-1)); }
unshift(@args, '') if(@args);
print '#define '.$type.($i > 1 ? ($i-1) : '').'(s';
print '#define '.$type.($i > 1 ? ($i-1) : '').'('.$rv.'s';
print join(', ', @args).') ';
if($forreal){ print 'fprintf(stderr, "[" __FILE__ ":%i] '.$type.': " s "\n", __LINE__'.join(', ', @args).")\n"; }
if($forreal){ print $pre.'fprintf(stderr, "[" __FILE__ ":%i] '.$type.': " s "\n", __LINE__'.join(', ', @args).")$post\n"; }
#else{ print "do {} while(0)\n"; }
else{ print "\n"; }
}