All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH v2 6/6] sensord: Break long lines in doChips()
@ 2009-10-26 20:57 Andre Prendel
  2009-10-29  8:18 ` [lm-sensors] [PATCH v2 6/6] sensord: Break long lines in Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Prendel @ 2009-10-26 20:57 UTC (permalink / raw)
  To: lm-sensors

This patch breaks long lines in function doChips().
---

 prog/sensord/sense.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Index: sensors/prog/sensord/sense.c
=================================--- sensors.orig/prog/sensord/sense.c	2009-10-26 21:32:05.000000000 +0100
+++ sensors/prog/sensord/sense.c	2009-10-26 21:32:23.000000000 +0100
@@ -209,17 +209,18 @@
 
 static int doChips(int action)
 {
-	const sensors_chip_name *chip;
+	const sensors_chip_name *chip, *chip_arg;
 	int i, j, ret = 0;
 
-	for (j = 0; (ret = 0) && (j < sensord_args.numChipNames); ++ j) {
+	for (j = 0; j < sensord_args.numChipNames; j++) {
+		chip_arg = &sensord_args.chipNames[j];
 		i = 0;
-		while ((ret = 0) &&
-		       ((chip = sensors_get_detected_chips(&sensord_args.chipNames[j], &i)) != NULL)) {
+		while ((chip = sensors_get_detected_chips(chip_arg, &i))) {
 			ret = doChip(chip, action);
+			if (ret)
+				break;
 		}
 	}
-
 	return ret;
 }
 

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [lm-sensors] [PATCH v2 6/6] sensord: Break long lines in
  2009-10-26 20:57 [lm-sensors] [PATCH v2 6/6] sensord: Break long lines in doChips() Andre Prendel
@ 2009-10-29  8:18 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2009-10-29  8:18 UTC (permalink / raw)
  To: lm-sensors

On Mon, 26 Oct 2009 21:57:57 +0100, Andre Prendel wrote:
> This patch breaks long lines in function doChips().
> ---
> 
>  prog/sensord/sense.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> Index: sensors/prog/sensord/sense.c
> =================================> --- sensors.orig/prog/sensord/sense.c	2009-10-26 21:32:05.000000000 +0100
> +++ sensors/prog/sensord/sense.c	2009-10-26 21:32:23.000000000 +0100
> @@ -209,17 +209,18 @@
>  
>  static int doChips(int action)
>  {
> -	const sensors_chip_name *chip;
> +	const sensors_chip_name *chip, *chip_arg;
>  	int i, j, ret = 0;
>  
> -	for (j = 0; (ret = 0) && (j < sensord_args.numChipNames); ++ j) {
> +	for (j = 0; j < sensord_args.numChipNames; j++) {
> +		chip_arg = &sensord_args.chipNames[j];
>  		i = 0;
> -		while ((ret = 0) &&
> -		       ((chip = sensors_get_detected_chips(&sensord_args.chipNames[j], &i)) != NULL)) {
> +		while ((chip = sensors_get_detected_chips(chip_arg, &i))) {
>  			ret = doChip(chip, action);
> +			if (ret)
> +				break;

This breaks out of the while loop but not the outermost for loop. This
is a slight change from the original code... on purpose or not? if not,
then a direct return might be better suited.

>  		}
>  	}
> -
>  	return ret;
>  }
>  


-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-29  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-26 20:57 [lm-sensors] [PATCH v2 6/6] sensord: Break long lines in doChips() Andre Prendel
2009-10-29  8:18 ` [lm-sensors] [PATCH v2 6/6] sensord: Break long lines in Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.