• Mauro Carvalho Chehab's avatar
    [media] drxd: Don't use a macro for CHK_ERROR with a break inside · 58d5eaec
    Mauro Carvalho Chehab authored
    The macro is defined as:
    	#define CHK_ERROR(s) if( (status = s)<0 ) break
    
    This sucks, as makes harder to debug if something got wrong and
    there are more than one level of loops. Also, violates CodingStyle.
    
    Fixed by this simple perl script:
    
    	while (<>) { $f.=$_; };
    
    	$f=~ s,\n\#define CHK_ERROR[^\n]+\n,\n,;
    
    	$f=~ s=(CHK_ERROR\(.*\,)\n\s+=\1 =g;
    	$f=~ s=(CHK_ERROR\(.*\,)\n\s+=\1 =g;
    	$f=~ s=(CHK_ERROR\(.*\,)\n\s+=\1 =g;
    	$f=~ s=(CHK_ERROR\(.*)\s+(\,)\n\s+=\1\2 =g;
    	$f=~ s=(CHK_ERROR\(.*)\s+(\,)\n\s+=\1\2 =g;
    	$f=~ s=(CHK_ERROR\(.*)\s+(\,)\n\s+=\1\2 =g;
    
    	$f=~ s,\n(\t+)CHK_ERROR\((.*)\)\;,\n\1status = \2;\n\1if (status < 0)\n\1\tbreak;,g;
    
    	print $f;
    
    Plus a few manual adjustments
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
    58d5eaec
drxd_hard.c 75.1 KB