summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1701942)
raw | patch | inline | side by side (parent: 1701942)
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | |
Sat, 21 Jun 2008 20:21:07 +0000 (22:21 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 24 Jun 2008 11:28:40 +0000 (13:28 +0200) |
src/common.c: move read_file_contents() from thermal plugin
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/common.c | patch | blob | history | |
src/common.h | patch | blob | history | |
src/thermal.c | patch | blob | history |
diff --git a/src/common.c b/src/common.c
index 39436178b65d736cbce4de17b5a7b741020a446c..bdab108c7baa270d8dff98639182be2747481b9b 100644 (file)
--- a/src/common.c
+++ b/src/common.c
return ok ? 0 : -1;
}
+int read_file_contents (const char *filename, char *buf, int bufsize)
+{
+ FILE *fh;
+ int n;
+
+ if ((fh = fopen (filename, "r")) == NULL)
+ return -1;
+
+ n = fread(buf, 1, bufsize, fh);
+ fclose(fh);
+
+ return n;
+}
+
diff --git a/src/common.h b/src/common.h
index ca34e7817b372be61cd486f031a94ad169c37879..a5e2167b6c1e3565a96d2e399aee0616923f3133 100644 (file)
--- a/src/common.h
+++ b/src/common.h
typedef int (*dirwalk_callback_f)(const char *filename);
int walk_directory (const char *dir, dirwalk_callback_f callback);
+int read_file_contents (const char *filename, char *buf, int bufsize);
#endif /* COMMON_H */
diff --git a/src/thermal.c b/src/thermal.c
index 29ea05f5d18641b261e731295ae70c79996017fc..93781328be182879748a7d23965f152ba37720a3 100644 (file)
--- a/src/thermal.c
+++ b/src/thermal.c
plugin_dispatch_values (&vl);
}
-static int read_file_contents (const char *filename, char *buf, int bufsize)
-{
- FILE *fh;
- int n;
-
- if ((fh = fopen (filename, "r")) == NULL)
- return -1;
-
- n = fread(buf, 1, bufsize, fh);
- fclose(fh);
-
- return n;
-}
-
static int thermal_sysfs_device_read (const char *name)
{
char filename[256];