From 7ba794d9ba79cac3a02b93199909e2c49886db29 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 13:24:46 +0000 Subject: [PATCH] Clean up the global variables: * do_sets, do_raw and hide_adapter are only used in main.c and could thus be declared static. * fahrenheit and degstr are used in chips.c as well, so they should be declared in a header file. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4713 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 4 +--- prog/sensors/main.c | 4 +++- prog/sensors/main.h | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 prog/sensors/main.h diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index caaa23d7..cb02a3a9 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -24,12 +24,10 @@ #include #include +#include "main.h" #include "chips.h" #include "lib/sensors.h" -extern int fahrenheit; -extern char degstr[5]; - static inline float deg_ctof(float cel) { return cel * (9.0F / 5.0F) + 32.0F; diff --git a/prog/sensors/main.c b/prog/sensors/main.c index e9ae9a0b..a1b60ee6 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -32,6 +32,7 @@ #include "lib/sensors.h" #include "lib/error.h" +#include "main.h" #include "chips.h" #include "version.h" @@ -39,8 +40,9 @@ #define VERSION LM_VERSION #define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" -int do_sets, do_raw, fahrenheit, hide_adapter; +static int do_sets, do_raw, hide_adapter; +int fahrenheit; char degstr[5]; /* store the correct string to print degrees */ static void print_short_help(void) diff --git a/prog/sensors/main.h b/prog/sensors/main.h new file mode 100644 index 00000000..4604b796 --- /dev/null +++ b/prog/sensors/main.h @@ -0,0 +1,26 @@ +/* + main.h - Part of sensors, a user-space program for hardware monitoring + Copyright (C) 2007 Jean Delvare + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef PROG_SENSORS_MAIN_H +#define PROG_SENSORS_MAIN_H + +extern int fahrenheit; +extern char degstr[5]; + +#endif /* PROG_SENSORS_MAIN_H */