Changeset 97
- Timestamp:
- 12/20/98 22:57:39 (10 years ago)
- Files:
-
- lm-sensors/trunk/lib/Module.mk (modified) (1 diff)
- lm-sensors/trunk/lib/access.c (modified) (1 diff)
- lm-sensors/trunk/lib/data.c (modified) (2 diffs)
- lm-sensors/trunk/lib/data.h (modified) (1 diff)
- lm-sensors/trunk/lib/error.c (modified) (1 diff)
- lm-sensors/trunk/lib/error.h (modified) (1 diff)
- lm-sensors/trunk/lib/init.c (added)
- lm-sensors/trunk/lib/sensors.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/trunk/lib/Module.mk
r95 r97 37 37 LIBCSOURCES := $(MODULE_DIR)/data.c $(MODULE_DIR)/general.c \ 38 38 $(MODULE_DIR)/error.c $(MODULE_DIR)/chips.c \ 39 $(MODULE_DIR)/proc.c $(MODULE_DIR)/access.c 39 $(MODULE_DIR)/proc.c $(MODULE_DIR)/access.c \ 40 $(MODULE_DIR)/init.c 40 41 LIBOTHEROBJECTS := $(MODULE_DIR)/conf-parse.o $(MODULE_DIR)/conf-lex.o 41 42 LIBSHOBJECTS := $(LIBCSOURCES:.c=.lo) $(LIBOTHEROBJECTS:.o=.lo) lm-sensors/trunk/lib/access.c
r95 r97 142 142 for (i = 0; i < chip->labels_count; i++) 143 143 if (!strcmp(featureptr->name, chip->labels[i].name)) { 144 *result = strdup(chip->labels[i].name); 144 if (! (*result = strdup(chip->labels[i].name))) 145 sensors_fatal_error("sensors_get_label","Allocating label text"); 145 146 return 0; 146 147 } 147 *result = strdup(featureptr->name); 148 if (! (*result = strdup(featureptr->name))) 149 sensors_fatal_error("sensors_get_label","Allocating label text"); 148 150 return 0; 149 151 } lm-sensors/trunk/lib/data.c
r95 r97 67 67 int i; 68 68 69 if (! name) 70 sensors_fatal_error("sensors_parse_chip_name","Allocating new name"); 69 71 /* First split name in upto four pieces. */ 70 72 if ((part4 = strrchr(name,'-'))) … … 156 158 if (!strcmp(name,"*")) 157 159 res->prefix = SENSORS_CHIP_NAME_PREFIX_ANY; 158 else 159 res->prefix = strdup(name);160 else if (! (res->prefix = strdup(name))) 161 sensors_fatal_error("sensors_parse_chip_name","Allocating new name"); 160 162 goto SUCCES; 161 163 lm-sensors/trunk/lib/data.h
r95 r97 23 23 #include "sensors.h" 24 24 25 /* This header file contains all kinds of data structures which are 26 internally used. */ 25 /* This header file contains all kinds of data structures which are used 26 for the representation of the config file data and the /proc/.../chips 27 data. */ 27 28 28 29 typedef enum sensors_operation { lm-sensors/trunk/lib/error.c
r91 r97 42 42 #define ERROR_LIST_LEN (sizeof(errorlist) / sizeof(char *)) 43 43 44 c har *sensors_strerror(int errnum)44 const char *sensors_strerror(int errnum) 45 45 { 46 46 if (errnum < 0) lm-sensors/trunk/lib/error.h
r91 r97 28 28 #define SENSORS_ERR_CHIP_NAME 6 /* Can't parse chip name */ 29 29 #define SENSORS_ERR_BUS_NAME 7 /* Can't parse bus name */ 30 #define SENSORS_ERR_PARSE 8 /* General parse error */ 30 31 31 32 /* This function returns a pointer to a string which describes the error. 32 33 errnum may be negative (the corresponding positive error is returned). 33 34 You may not modify the result! */ 34 extern c har *sensors_strerror(int errnum);35 extern const char *sensors_strerror(int errnum); 35 36 36 37 /* This function is called when a parse error is detected. Give it a new lm-sensors/trunk/lib/sensors.h
r95 r97 35 35 } sensors_chip_name; 36 36 37 /* (Re)load the configuration file and the detected chips list. */ 38 extern int sensors_init(void); 39 40 /* Strictly optional clean-up function: You can't access anything after 41 this, until the next sensors_init() call! */ 42 extern void sensors_cleanup(void); 43 44 37 45 /* Parse a chip name to the internal representation. Return 0 on succes, <0 38 46 on error. */
