projects
/
psensor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cb3ae20
)
removed useless union
author
Jean-Philippe Orsini
<jeanfi@gmail.com>
Thu, 26 Apr 2012 10:40:08 +0000
(10:40 +0000)
committer
Jean-Philippe Orsini
<jeanfi@gmail.com>
Thu, 26 Apr 2012 10:40:08 +0000
(10:40 +0000)
src/graph.c
patch
|
blob
|
history
src/lib/measure.c
patch
|
blob
|
history
src/lib/measure.h
patch
|
blob
|
history
src/lib/psensor.c
patch
|
blob
|
history
src/lib/psensor_json.c
patch
|
blob
|
history
src/ui_notify.c
patch
|
blob
|
history
src/ui_sensorlist.c
patch
|
blob
|
history
diff --git
a/src/graph.c
b/src/graph.c
index
06d7c8b
..
a52b69e
100644
(file)
--- a/
src/graph.c
+++ b/
src/graph.c
@@
-187,7
+187,7
@@
static void draw_sensor_curve(struct psensor *s,
first = 1;
for (i = 0; i < s->values_max_length; i++) {
t = s->measures[i].time.tv_sec;
first = 1;
for (i = 0; i < s->values_max_length; i++) {
t = s->measures[i].time.tv_sec;
- v = s->measures[i].value
.d_num
;
+ v = s->measures[i].value;
if (v == UNKNOWN_DBL_VALUE || !t)
continue;
if (v == UNKNOWN_DBL_VALUE || !t)
continue;
diff --git
a/src/lib/measure.c
b/src/lib/measure.c
index
92aa5bd
..
9f6225a
100644
(file)
--- a/
src/lib/measure.c
+++ b/
src/lib/measure.c
@@
-30,7
+30,7
@@
struct measure *measures_dbl_create(int size)
result = malloc(size * sizeof(struct measure));
for (i = 0; i < size; i++) {
result = malloc(size * sizeof(struct measure));
for (i = 0; i < size; i++) {
- result[i].value
.d_num
= UNKNOWN_DBL_VALUE;
+ result[i].value = UNKNOWN_DBL_VALUE;
timerclear(&result[i].time);
}
timerclear(&result[i].time);
}
diff --git
a/src/lib/measure.h
b/src/lib/measure.h
index
f95ce51
..
b25fcff
100644
(file)
--- a/
src/lib/measure.h
+++ b/
src/lib/measure.h
@@
-26,10
+26,7
@@
#define UNKNOWN_DBL_VALUE DBL_MIN
struct measure {
#define UNKNOWN_DBL_VALUE DBL_MIN
struct measure {
- union value {
- double d_num;
- uint64_t ui64_num;
- } value;
+ double value;
struct timeval time;
};
struct timeval time;
};
diff --git
a/src/lib/psensor.c
b/src/lib/psensor.c
index
89ed97e
..
4efbdc6
100644
(file)
--- a/
src/lib/psensor.c
+++ b/
src/lib/psensor.c
@@
-255,7
+255,7
@@
psensor_set_current_measure(struct psensor *s,
&s->measures[1],
(s->values_max_length - 1) * sizeof(struct measure));
&s->measures[1],
(s->values_max_length - 1) * sizeof(struct measure));
- s->measures[s->values_max_length - 1].value
.d_num
= v;
+ s->measures[s->values_max_length - 1].value = v;
s->measures[s->values_max_length - 1].time = tv;
if (s->min == UNKNOWN_DBL_VALUE || v < s->min)
s->measures[s->values_max_length - 1].time = tv;
if (s->min == UNKNOWN_DBL_VALUE || v < s->min)
@@
-279,7
+279,7
@@
psensor_set_current_measure(struct psensor *s,
double psensor_get_current_value(struct psensor *sensor)
{
double psensor_get_current_value(struct psensor *sensor)
{
- return sensor->measures[sensor->values_max_length - 1].value
.d_num
;
+ return sensor->measures[sensor->values_max_length - 1].value;
}
struct measure *psensor_get_current_measure(struct psensor *sensor)
}
struct measure *psensor_get_current_measure(struct psensor *sensor)
@@
-304,7
+304,7
@@
double get_min_value(struct psensor **sensors, int type)
double t;
for (i = 0; i < sensor->values_max_length; i++) {
double t;
for (i = 0; i < sensor->values_max_length; i++) {
- t = sensor->measures[i].value
.d_num
;
+ t = sensor->measures[i].value;
if (t == UNKNOWN_DBL_VALUE)
continue;
if (t == UNKNOWN_DBL_VALUE)
continue;
@@
-335,7
+335,7
@@
double get_max_value(struct psensor **sensors, int type)
int i;
double t;
for (i = 0; i < sensor->values_max_length; i++) {
int i;
double t;
for (i = 0; i < sensor->values_max_length; i++) {
- t = sensor->measures[i].value
.d_num
;
+ t = sensor->measures[i].value;
if (t == UNKNOWN_DBL_VALUE)
continue;
if (t == UNKNOWN_DBL_VALUE)
continue;
diff --git
a/src/lib/psensor_json.c
b/src/lib/psensor_json.c
index
1d4668c
..
18058bf
100644
(file)
--- a/
src/lib/psensor_json.c
+++ b/
src/lib/psensor_json.c
@@
-39,7
+39,7
@@
measure_to_json_object(struct measure *m)
json_object_object_add(o,
ATT_MEASURE_VALUE,
json_object_object_add(o,
ATT_MEASURE_VALUE,
- json_object_new_double(m->value
.d_num
));
+ json_object_new_double(m->value));
json_object_object_add(o, ATT_MEASURE_TIME,
json_object_new_int((m->time).tv_sec));
return o;
json_object_object_add(o, ATT_MEASURE_TIME,
json_object_new_int((m->time).tv_sec));
return o;
@@
-89,7
+89,7
@@
static json_object *sensor_to_json(struct psensor *s)
mo = json_object_new_object();
json_object_object_add(mo,
ATT_MEASURE_VALUE,
mo = json_object_new_object();
json_object_object_add(mo,
ATT_MEASURE_VALUE,
- json_object_new_double(m->value
.d_num
));
+ json_object_new_double(m->value));
json_object_object_add(mo, ATT_MEASURE_TIME,
json_object_new_int((m->time).tv_sec));
json_object_object_add(obj, ATT_SENSOR_LAST_MEASURE, mo);
json_object_object_add(mo, ATT_MEASURE_TIME,
json_object_new_int((m->time).tv_sec));
json_object_object_add(obj, ATT_SENSOR_LAST_MEASURE, mo);
diff --git
a/src/ui_notify.c
b/src/ui_notify.c
index
d547845
..
0f48226
100644
(file)
--- a/
src/ui_notify.c
+++ b/
src/ui_notify.c
@@
-36,7
+36,7
@@
static struct timeval last_notification_tv;
void ui_notify(struct psensor *sensor, struct ui_psensor *ui)
{
struct timeval t;
void ui_notify(struct psensor *sensor, struct ui_psensor *ui)
{
struct timeval t;
- char *
name
;
+ char *
body
;
NotifyNotification *notif;
log_debug("last_notification %d", last_notification_tv.tv_sec);
NotifyNotification *notif;
log_debug("last_notification %d", last_notification_tv.tv_sec);
@@
-56,7
+56,7
@@
void ui_notify(struct psensor *sensor, struct ui_psensor *ui)
notify_init("psensor");
if (notify_is_initted() == TRUE) {
notify_init("psensor");
if (notify_is_initted() == TRUE) {
-
name
= strdup(sensor->name);
+
body
= strdup(sensor->name);
/*
* Since libnotify 0.7 notify_notification_new has
/*
* Since libnotify 0.7 notify_notification_new has
@@
-64,14
+64,14
@@
void ui_notify(struct psensor *sensor, struct ui_psensor *ui)
*/
#if NOTIFY_CHECK_VERSION(0, 7, 0)
notif = notify_notification_new
*/
#if NOTIFY_CHECK_VERSION(0, 7, 0)
notif = notify_notification_new
- (_("Temperature alert"),
name
, PSENSOR_ICON);
+ (_("Temperature alert"),
body
, PSENSOR_ICON);
#else
notif = notify_notification_new(_("Temperature alert"),
#else
notif = notify_notification_new(_("Temperature alert"),
-
name
,
+
body
,
PSENSOR_ICON,
GTK_WIDGET(ui->main_window));
#endif
PSENSOR_ICON,
GTK_WIDGET(ui->main_window));
#endif
- log_debug("notif_notification_new %s",
sensor->name
);
+ log_debug("notif_notification_new %s",
body
);
notify_notification_show(notif, NULL);
notify_notification_show(notif, NULL);
diff --git
a/src/ui_sensorlist.c
b/src/ui_sensorlist.c
index
b4ac650
..
2809b51
100644
(file)
--- a/
src/ui_sensorlist.c
+++ b/
src/ui_sensorlist.c
@@
-73,7
+73,7
@@
void ui_sensorlist_update(struct ui_psensor *ui)
str = psensor_value_to_string(s->type,
s->measures[s->values_max_length -
str = psensor_value_to_string(s->type,
s->measures[s->values_max_length -
- 1].value
.d_num
,
+ 1].value,
use_celcius);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_TEMP, str,
use_celcius);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_TEMP, str,