···4242#endif
4343}
44444545-int configfile_save(const char *filename, struct configdata *cfg,
4545+int configfile_save(const char *filename, const struct configdata *cfg,
4646 int num_items, int version)
4747{
4848 int fd;
···56565757 /* pre-allocate 10 bytes for INT */
5858 rb->fdprintf(fd, "file version: %10d\n", version);
5959-5959+6060 for(i = 0;i < num_items;i++) {
6161 switch(cfg[i].type) {
6262 case TYPE_INT:
···9191 return 0;
9292}
93939494-int configfile_load(const char *filename, struct configdata *cfg,
9494+int configfile_load(const char *filename, const struct configdata *cfg,
9595 int num_items, int min_version)
9696{
9797 int fd;
···118118 return -1;
119119 }
120120 }
121121-121121+122122 for(i = 0;i < num_items;i++) {
123123 if(!rb->strcmp(cfg[i].name, name)) {
124124 switch(cfg[i].type) {
···149149 }
150150 }
151151 }
152152-152152+153153 rb->close(fd);
154154 return 0;
155155}
···190190 int found = 0;
191191 int line_len = 0;
192192 int pos = 0;
193193-193193+194194 /* open the current config file */
195195 get_cfg_filename(path, MAX_PATH, filename);
196196 fd = rb->open(path, O_RDWR);
197197 if(fd < 0)
198198 return -1;
199199-199199+200200 /* read in the current stored settings */
201201 while((line_len = rb->read_line(fd, buf, 256)) > 0)
202202 {
···211211 }
212212 pos += line_len;
213213 }
214214-214214+215215 /* if (name/val) is a new entry just append to file */
216216 if (found == 0)
217217 /* pre-allocate 10 bytes for INT */
218218 rb->fdprintf(fd, "%s: %10d\n", name, val);
219219-219219+220220 rb->close(fd);
221221-221221+222222 return found;
223223}
+2-2
apps/plugins/lib/configfile.h
···4545/* configfile_save - Given configdata entries this function will
4646 create a config file with these entries, destroying any
4747 previous config file of the same name */
4848-int configfile_save(const char *filename, struct configdata *cfg,
4848+int configfile_save(const char *filename, const struct configdata *cfg,
4949 int num_items, int version);
50505151-int configfile_load(const char *filename, struct configdata *cfg,
5151+int configfile_load(const char *filename, const struct configdata *cfg,
5252 int num_items, int min_version);
53535454/* configfile_get_value - Given a key name, this function will