/*
- * Copyright (C) 2010-2013 jeanfi@gmail.com
+ * 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
unsigned int type,
int values_max_length)
{
- struct psensor *psensor
- = (struct psensor *)malloc(sizeof(struct psensor));
+ struct psensor *psensor;
+
+ psensor = (struct psensor *)malloc(sizeof(struct psensor));
psensor->id = id;
psensor->name = name;
while (*s) {
struct psensor *sensor = *s;
- if (sensor->graph_enabled && (sensor->type & type)) {
+ if (sensor->type & type) {
int i;
double t;
while (*s) {
struct psensor *sensor = *s;
- if (sensor->graph_enabled && (sensor->type & type)) {
+ if (sensor->type & type) {
int i;
double t;
for (i = 0; i < sensor->values_max_length; i++) {
psensor_get_current_value(s),
celcius);
}
+
+struct psensor **psensor_list_filter_graph_enabled(struct psensor **sensors)
+{
+ int n, i;
+ struct psensor **result, **cur, *s;
+
+ if (!sensors)
+ return NULL;
+
+ n = psensor_list_size(sensors);
+ result = malloc((n+1) * sizeof(struct psensor *));
+
+ for (cur = sensors, i = 0; *cur; cur++) {
+ s = *cur;
+
+ if (s->graph_enabled)
+ result[i++] = s;
+ }
+
+ result[i] = NULL;
+
+ return result;
+}