forked from github/server
let callers pass memory into create_order_i
This commit is contained in:
parent
9a1295b4a5
commit
e0514eddb5
|
@ -284,12 +284,12 @@ void close_orders(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static order *create_order_i(keyword_t kwd, const char *sptr, bool persistent,
|
static order *create_order_i(order *ord, keyword_t kwd, const char *sptr, bool persistent,
|
||||||
bool noerror, const struct locale *lang)
|
bool noerror, const struct locale *lang)
|
||||||
{
|
{
|
||||||
order *ord = NULL;
|
|
||||||
int lindex;
|
int lindex;
|
||||||
|
|
||||||
|
assert(ord);
|
||||||
if (kwd == NOKEYWORD || keyword_disabled(kwd)) {
|
if (kwd == NOKEYWORD || keyword_disabled(kwd)) {
|
||||||
log_error("trying to create an order for disabled keyword %s.", keyword(kwd));
|
log_error("trying to create an order for disabled keyword %s.", keyword(kwd));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -316,7 +316,6 @@ static order *create_order_i(keyword_t kwd, const char *sptr, bool persistent,
|
||||||
}
|
}
|
||||||
locale_array[lindex]->lang = lang;
|
locale_array[lindex]->lang = lang;
|
||||||
|
|
||||||
ord = (order *)malloc(sizeof(order));
|
|
||||||
ord->_persistent = persistent;
|
ord->_persistent = persistent;
|
||||||
ord->_noerror = noerror;
|
ord->_noerror = noerror;
|
||||||
ord->next = NULL;
|
ord->next = NULL;
|
||||||
|
@ -330,6 +329,7 @@ static order *create_order_i(keyword_t kwd, const char *sptr, bool persistent,
|
||||||
order *create_order(keyword_t kwd, const struct locale * lang,
|
order *create_order(keyword_t kwd, const struct locale * lang,
|
||||||
const char *params, ...)
|
const char *params, ...)
|
||||||
{
|
{
|
||||||
|
order *ord;
|
||||||
char zBuffer[DISPLAYSIZE];
|
char zBuffer[DISPLAYSIZE];
|
||||||
if (params) {
|
if (params) {
|
||||||
char *bufp = zBuffer;
|
char *bufp = zBuffer;
|
||||||
|
@ -380,7 +380,8 @@ order *create_order(keyword_t kwd, const struct locale * lang,
|
||||||
else {
|
else {
|
||||||
zBuffer[0] = 0;
|
zBuffer[0] = 0;
|
||||||
}
|
}
|
||||||
return create_order_i(kwd, zBuffer, false, false, lang);
|
ord = (order *)malloc(sizeof(order));
|
||||||
|
return create_order_i(ord, kwd, zBuffer, false, false, lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
order *parse_order(const char *s, const struct locale * lang)
|
order *parse_order(const char *s, const struct locale * lang)
|
||||||
|
@ -411,7 +412,8 @@ order *parse_order(const char *s, const struct locale * lang)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (kwd != NOKEYWORD) {
|
if (kwd != NOKEYWORD) {
|
||||||
return create_order_i(kwd, sptr, persistent, noerror, lang);
|
order *ord = (order *)malloc(sizeof(order));
|
||||||
|
return create_order_i(ord, kwd, sptr, persistent, noerror, lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue