create_data: remove short-lived allocation.

This commit is contained in:
Enno Rehling 2020-08-13 16:20:52 +02:00
parent f7dc15b64f
commit bf00a9a994
1 changed files with 3 additions and 8 deletions

View File

@ -252,8 +252,7 @@ void free_orders(order ** olist)
static int create_data(keyword_t kwd, const char *s,
const struct locale *lang)
{
order_data *data;
int id;
order_data data = { NULL, 0 };
assert(kwd != NOKEYWORD);
@ -267,12 +266,8 @@ static int create_data(keyword_t kwd, const char *s,
return ((int)sk)-100;
}
}
/* TODO: between mkdata and odata_release, this object is very
* short-lived. */
odata_create(&data, strlen(s), s);
id = odata_save(data);
odata_release(data);
return id;
data._str = s;
return odata_save(&data);
}
static void create_order_i(order *ord, keyword_t kwd, const char *sptr, bool persistent,