diff --git a/src/conky.h b/src/conky.h index d4f60c1c..d6434a7f 100644 --- a/src/conky.h +++ b/src/conky.h @@ -116,11 +116,6 @@ struct text_object; #include "xmms2.h" #endif -#ifdef IBM -#include "ibm.h" -#include "smapi.h" -#endif - #ifdef APCUPSD #include "apcupsd.h" #endif diff --git a/src/core.cc b/src/core.cc index 32c76a13..446a4b8f 100644 --- a/src/core.cc +++ b/src/core.cc @@ -46,6 +46,10 @@ #include "fonts.h" #endif #include "fs.h" +#ifdef IBM +#include "ibm.h" +#include "smapi.h" +#endif #ifdef HAVE_ICONV #include "iconv_tools.h" #endif diff --git a/src/ibm.h b/src/ibm.h index 1029969c..94f5f3dd 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -3,8 +3,6 @@ #ifndef _IBM_H #define _IBM_H -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/src/smapi.c b/src/smapi.c index 5c7ed29b..6a579686 100644 --- a/src/smapi.c +++ b/src/smapi.c @@ -22,7 +22,6 @@ * */ #include "conky.h" /* text_buffer_size, PACKAGE_NAME, maybe more */ -#include "smapi.h" #include "temphelper.h" #include "logging.h" #include @@ -33,7 +32,18 @@ #define SYS_SMAPI_PATH "/sys/devices/platform/smapi" -int smapi_bat_installed_internal(int idx) +static int smapi_read_int(const char *path) +{ + FILE *fp; + int i = 0; + if ((fp = fopen(path, "r")) != NULL) { + fscanf(fp, "%i\n", &i); + fclose(fp); + } + return i; +} + +static int smapi_bat_installed_internal(int idx) { char path[128]; struct stat sb; @@ -48,7 +58,7 @@ int smapi_bat_installed_internal(int idx) } -char *smapi_read_str(const char *path) +static char *smapi_read_str(const char *path) { FILE *fp; char str[256] = "failed"; @@ -59,18 +69,7 @@ char *smapi_read_str(const char *path) return strndup(str, text_buffer_size); } -int smapi_read_int(const char *path) -{ - FILE *fp; - int i = 0; - if ((fp = fopen(path, "r")) != NULL) { - fscanf(fp, "%i\n", &i); - fclose(fp); - } - return i; -} - -char *smapi_get_str(const char *fname) +static char *smapi_get_str(const char *fname) { char path[128]; if(snprintf(path, 127, SYS_SMAPI_PATH "/%s", fname) < 0) @@ -79,7 +78,7 @@ char *smapi_get_str(const char *fname) return smapi_read_str(path); } -char *smapi_get_bat_str(int idx, const char *fname) +static char *smapi_get_bat_str(int idx, const char *fname) { char path[128]; if(snprintf(path, 127, SYS_SMAPI_PATH "/BAT%i/%s", idx, fname) < 0) @@ -87,7 +86,7 @@ char *smapi_get_bat_str(int idx, const char *fname) return smapi_read_str(path); } -int smapi_get_bat_int(int idx, const char *fname) +static int smapi_get_bat_int(int idx, const char *fname) { char path[128]; if(snprintf(path, 127, SYS_SMAPI_PATH "/BAT%i/%s", idx, fname) < 0) @@ -95,7 +94,7 @@ int smapi_get_bat_int(int idx, const char *fname) return smapi_read_int(path); } -char *smapi_get_bat_val(const char *args) +static char *smapi_get_bat_val(const char *args) { char fname[128]; int idx, cnt; @@ -112,7 +111,7 @@ char *smapi_get_bat_val(const char *args) return smapi_get_bat_str(idx, fname); } -char *smapi_get_val(const char *args) +static char *smapi_get_val(const char *args) { char str[128]; diff --git a/src/smapi.h b/src/smapi.h index 138749dc..77f5d7ab 100644 --- a/src/smapi.h +++ b/src/smapi.h @@ -28,18 +28,6 @@ extern "C" { #endif -int smapi_bat_installed_internal(int); - -char *smapi_read_str(const char *); -int smapi_read_int(const char *); - -char *smapi_get_str(const char *); -char *smapi_get_val(const char *); - -char *smapi_get_bat_str(int, const char *); -int smapi_get_bat_int(int, const char *); -char *smapi_get_bat_val(const char *); - void print_smapi(struct text_object *, char *, int); uint8_t smapi_bat_percentage(struct text_object *); void print_smapi_bat_temp(struct text_object *, char *, int);