Fixed some bugs.
FossilOrigin-Name: 7271c87e31b7228f84b5ad700125b2bc6ebd1a6a3df539b2a0c09ac5585858ee
This commit is contained in:
parent
16feb002cf
commit
2688275111
@ -61,12 +61,7 @@ static inline int cw_action_in_cmp(const void *elem1,const void *elem2)
|
|||||||
|
|
||||||
cw_action_in_t * cw_actionlist_in_add(cw_actionlist_in_t t, struct cw_action_in * a)
|
cw_action_in_t * cw_actionlist_in_add(cw_actionlist_in_t t, struct cw_action_in * a)
|
||||||
{
|
{
|
||||||
struct cw_action_in *an = malloc(sizeof(struct cw_action_in));
|
return cw_actionlist_add(t,a,sizeof(struct cw_action_in));
|
||||||
if (!an)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
memcpy(an,a,sizeof(struct cw_action_in));
|
|
||||||
return avltree_add(t,an);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,19 +133,16 @@ static int cw_action_out_cmp(const void *elem1,const void *elem2)
|
|||||||
*/
|
*/
|
||||||
void * cw_actionlist_add(struct avltree *t, void *a, size_t s)
|
void * cw_actionlist_add(struct avltree *t, void *a, size_t s)
|
||||||
{
|
{
|
||||||
uint8_t * an = malloc(s);
|
void * r = avltree_replace_data(t,a,sizeof(struct cw_action_in));
|
||||||
if (!an)
|
if (r)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
void *an = malloc(sizeof(struct cw_action_in));
|
||||||
|
if (!an)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memcpy(an,a,s);
|
memcpy(an,a,s);
|
||||||
void * r = avltree_add(t,an);
|
return avltree_add(t,an);
|
||||||
if (r==an)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
/* action already exists, replace */
|
|
||||||
memcpy(r,an,sizeof(struct cw_action_out));
|
|
||||||
free (an);
|
|
||||||
return r;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +160,6 @@ cw_actionlist_out_t cw_actionlist_out_create()
|
|||||||
cw_action_out_t * cw_actionlist_out_add(cw_actionlist_out_t t, struct cw_action_out * a)
|
cw_action_out_t * cw_actionlist_out_add(cw_actionlist_out_t t, struct cw_action_out * a)
|
||||||
{
|
{
|
||||||
return cw_actionlist_add(t,a,sizeof (struct cw_action_out));
|
return cw_actionlist_add(t,a,sizeof (struct cw_action_out));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user