summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2f1955e)
raw | patch | inline | side by side (parent: 2f1955e)
author | Florian Forster <octo@huhu.verplant.org> | |
Thu, 3 May 2007 09:16:29 +0000 (11:16 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Thu, 3 May 2007 09:16:29 +0000 (11:16 +0200) |
This is a TODO.
src/types_list.c | patch | blob | history |
diff --git a/src/types_list.c b/src/types_list.c
index 1bbf142b9dbe85ccf19fff5c4fae34d0f1134de5..6fce0190f3046405506b0ea83fc7ba6e8d5aa5ee 100644 (file)
--- a/src/types_list.c
+++ b/src/types_list.c
{
char *fields[64];
size_t fields_num;
- data_set_t ds;
+ data_set_t *ds;
int i;
fields_num = strsplit (buf, fields, 64);
if (fields_num < 2)
return;
- memset (&ds, '\0', sizeof (ds));
+ ds = (data_set_t *) malloc (sizeof (data_set_t));
+ if (ds == NULL)
+ return;
+
+ memset (ds, '\0', sizeof (data_set_t));
- strncpy (ds.type, fields[0], sizeof (ds.type));
- ds.type[sizeof (ds.type) - 1] = '\0';
+ strncpy (ds->type, fields[0], sizeof (ds->type));
+ ds->type[sizeof (ds->type) - 1] = '\0';
- ds.ds_num = fields_num - 1;
- ds.ds = (data_source_t *) calloc (ds.ds_num, sizeof (data_source_t));
- if (ds.ds == NULL)
+ ds->ds_num = fields_num - 1;
+ ds->ds = (data_source_t *) calloc (ds->ds_num, sizeof (data_source_t));
+ if (ds->ds == NULL)
return;
- for (i = 0; i < ds.ds_num; i++)
- if (parse_ds (ds.ds + i, fields[i + 1], strlen (fields[i + 1])) != 0)
+ for (i = 0; i < ds->ds_num; i++)
+ if (parse_ds (ds->ds + i, fields[i + 1], strlen (fields[i + 1])) != 0)
{
- sfree (ds.ds);
+ sfree (ds->ds);
ERROR ("types_list: parse_line: Cannot parse data source #%i "
- "of data set %s", i, ds.type);
+ "of data set %s", i, ds->type);
return;
}
DEBUG ("parse_line: ds = {%s, %i, %p};",
- ds.type, ds.ds_num, (void *) ds.ds);
+ ds->type, ds->ds_num, (void *) ds->ds);
- plugin_register_data_set (&ds);
- sfree (ds.ds);
+ plugin_register_data_set (ds);
+ /* Do NOT free `ds' and `ds->ds', because it's NOT copied by
+ * `plugin_register_data_set'!. */
} /* void parse_line */
static void parse_file (FILE *fh)