From: Jean-Philippe Orsini Date: Fri, 22 Aug 2014 23:18:37 +0000 (+0200) Subject: put temperature conversion functions into a separate file. X-Git-Tag: v1.1.1~14 X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=commitdiff_plain;h=0f8920132b54243de7e911c56c87ae88300d1592 put temperature conversion functions into a separate file. --- diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index da1dbfb..c7052b4 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -15,6 +15,7 @@ libpsensor_a_SOURCES = \ ptime.h ptime.c\ pio.h pio.c\ slog.c slog.h\ + temperature.c temperature.h\ url.c url.h AM_CPPFLAGS = -Wall -Werror diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 818b594..044bfb7 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -81,9 +81,9 @@ libpsensor_a_LIBADD = am__libpsensor_a_SOURCES_DIST = amd.h bool.h color.h color.c cpu.h \ hdd.h hdd_hddtemp.c lmsensor.h lmsensor.c measure.h measure.c \ nvidia.h plog.h plog.c pmutex.h pmutex.c psensor.h psensor.c \ - ptime.h ptime.c pio.h pio.c slog.c slog.h url.c url.h \ - hdd_atasmart.c nvidia.c amd.c cpu.c psensor_json.h \ - psensor_json.c + ptime.h ptime.c pio.h pio.c slog.c slog.h temperature.c \ + temperature.h url.c url.h hdd_atasmart.c nvidia.c amd.c cpu.c \ + psensor_json.h psensor_json.c @ATASMART_TRUE@am__objects_1 = hdd_atasmart.$(OBJEXT) @NVIDIA_TRUE@am__objects_2 = nvidia.$(OBJEXT) @LIBATIADL_TRUE@am__objects_3 = amd.$(OBJEXT) @@ -92,9 +92,9 @@ am__libpsensor_a_SOURCES_DIST = amd.h bool.h color.h color.c cpu.h \ am_libpsensor_a_OBJECTS = color.$(OBJEXT) hdd_hddtemp.$(OBJEXT) \ lmsensor.$(OBJEXT) measure.$(OBJEXT) plog.$(OBJEXT) \ pmutex.$(OBJEXT) psensor.$(OBJEXT) ptime.$(OBJEXT) \ - pio.$(OBJEXT) slog.$(OBJEXT) url.$(OBJEXT) $(am__objects_1) \ - $(am__objects_2) $(am__objects_3) $(am__objects_4) \ - $(am__objects_5) + pio.$(OBJEXT) slog.$(OBJEXT) temperature.$(OBJEXT) \ + url.$(OBJEXT) $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) $(am__objects_4) $(am__objects_5) libpsensor_a_OBJECTS = $(am_libpsensor_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -272,9 +272,9 @@ noinst_LIBRARIES = libpsensor.a libpsensor_a_SOURCES = amd.h bool.h color.h color.c cpu.h hdd.h \ hdd_hddtemp.c lmsensor.h lmsensor.c measure.h measure.c \ nvidia.h plog.h plog.c pmutex.h pmutex.c psensor.h psensor.c \ - ptime.h ptime.c pio.h pio.c slog.c slog.h url.c url.h \ - $(am__append_1) $(am__append_4) $(am__append_7) \ - $(am__append_8) $(am__append_11) + ptime.h ptime.c pio.h pio.c slog.c slog.h temperature.c \ + temperature.h url.c url.h $(am__append_1) $(am__append_4) \ + $(am__append_7) $(am__append_8) $(am__append_11) AM_CPPFLAGS = -Wall -Werror $(am__append_3) $(am__append_6) \ $(am__append_10) $(am__append_13) EXTRA_DIST = $(libpsensor_a_SOURCES) \ @@ -345,6 +345,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psensor_json.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/temperature.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url.Po@am__quote@ .c.o: diff --git a/src/lib/psensor.c b/src/lib/psensor.c index 348885a..9f063d0 100644 --- a/src/lib/psensor.c +++ b/src/lib/psensor.c @@ -23,9 +23,10 @@ #include #define _(str) gettext(str) -#include "hdd.h" -#include "psensor.h" -#include "lmsensor.h" +#include +#include +#include +#include #ifdef HAVE_GTOP #include "cpu.h" @@ -209,16 +210,6 @@ int is_fan_type(unsigned int type) return type & SENSOR_TYPE_FAN; } -double celsius_to_fahrenheit(double c) -{ - return c * (9.0/5.0) + 32; -} - -double fahrenheit_to_celsius(double f) -{ - return (f - 32) * (5.0/9.0); -} - char * psensor_value_to_str(unsigned int type, double value, int use_celsius) { diff --git a/src/lib/psensor.h b/src/lib/psensor.h index cb30cb9..b7d73b4 100644 --- a/src/lib/psensor.h +++ b/src/lib/psensor.h @@ -205,9 +205,6 @@ void psensor_cleanup(); double get_max_value(struct psensor **sensors, int type); -double celsius_to_fahrenheit(double c); -double fahrenheit_to_celsius(double c); - char *psensor_current_value_to_str(const struct psensor *, unsigned int); void psensor_log_measures(struct psensor **sensors); diff --git a/src/lib/temperature.c b/src/lib/temperature.c new file mode 100644 index 0000000..3e74898 --- /dev/null +++ b/src/lib/temperature.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2010-2014 jeanfi@gmail.com + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +#include + +double celsius_to_fahrenheit(double c) +{ + return c * (9.0/5.0) + 32; +} + +double fahrenheit_to_celsius(double f) +{ + return (f - 32) * (5.0/9.0); +} + diff --git a/src/lib/temperature.h b/src/lib/temperature.h new file mode 100644 index 0000000..b36c90e --- /dev/null +++ b/src/lib/temperature.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010-2014 jeanfi@gmail.com + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +#ifndef _PSENSOR_TEMPERATURE_H_ +#define _PSENSOR_TEMPERATURE_H_ + +double celsius_to_fahrenheit(double c); +double fahrenheit_to_celsius(double c); + +#endif diff --git a/src/ui_sensorpref.c b/src/ui_sensorpref.c index 9e8447e..0fa57e0 100644 --- a/src/ui_sensorpref.c +++ b/src/ui_sensorpref.c @@ -20,11 +20,13 @@ #include -#include "cfg.h" -#include "ui_pref.h" -#include "ui_sensorlist.h" -#include "ui_sensorpref.h" -#include "ui_color.h" +#include +#include +#include +#include +#include +#include + #if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029) #include "ui_appindicator.h" diff --git a/src/ui_unity.c b/src/ui_unity.c index 17ee29d..a8f8b20 100644 --- a/src/ui_unity.c +++ b/src/ui_unity.c @@ -18,6 +18,7 @@ */ #include +#include #include static int initialized;