/* get_gint_from_infofile(): * If the sys_file exists, then its value is converted to an int, * divided by 1000, and returned. * Failure is indicated by returning -1. */ static gint get_gint_from_infofile(battery *b, gchar *sys_file) { gchar *file_content = parse_info_file(b, sys_file); if (file_content != NULL) return atoi(file_content) / 1000; return -1; }
/* get_gint_from_infofile(): * If the sys_file exists, then its value is converted to an int, * divided by 1000, and returned. * Failure is indicated by returning -1. */ static gint get_gint_from_infofile(battery *b, gchar *sys_file) { gchar *file_content = parse_info_file(b, sys_file); gint value = -1; if (file_content != NULL) value = atoi(file_content) / 1000; g_free(file_content); return value; }
static gchar* get_gchar_from_infofile(battery *b, gchar *sys_file) { return parse_info_file(b, sys_file); }