[PATCH] deallocvt coding style

Bernhard Fischer rep.nop at aon.at
Fri Mar 10 23:14:35 UTC 2006


On Fri, Mar 10, 2006 at 11:51:07PM +0100, Tito wrote:
>Hi,
>this is just a coding style patch for deallocvt.c.
>No code changes. Please apply.
>
>Thanks.
>
>Ciao,
>Tito

>--- console-tools/deallocvt_orig.c	2006-03-10 20:41:37.000000000 +0100
>+++ console-tools/deallocvt.c	2006-03-10 23:26:59.000000000 +0100
>@@ -37,11 +37,11 @@
> 	/* num = 0 deallocate all unused consoles */
> 	int num = 0;
> 
>-	switch(argc)

Is the switch smaller than expanding this to if here (let's say for
gcc-4.x) ?
>-	{
>+	switch (argc) {
> 		case 2:
>-			if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0)
>+			if ((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0) {
> 				bb_error_msg_and_die("0: illegal VT number");
>+			}
> 		/* Fallthrough */
> 		case 1:
> 			break;
>@@ -49,7 +49,7 @@
> 			bb_show_usage();
> 	}
> 
>-	if (-1 == ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
>+	if (-1 == ioctl(get_console_fd(), VT_DISALLOCATE, num)) {

better say if (<0  shouldn't matter size-wise here but i didn't look. Is
it?

> 		bb_perror_msg_and_die("VT_DISALLOCATE");
> 	}
> 	return EXIT_SUCCESS;



More information about the busybox mailing list