Skip to content

Commit

Permalink
ST: Use inline for clist.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Aug 21, 2024
1 parent 4927046 commit 98ab8c1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 32 deletions.
28 changes: 0 additions & 28 deletions trunk/3rdparty/st-srs/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,6 @@

#include "common.h"

void st_clist_init(_st_clist_t *l)
{
l->next = l;
l->prev = l;
}

void st_clist_remove(_st_clist_t *e)
{
e->prev->next = e->next;
e->next->prev = e->prev;
}

void st_clist_insert_before(_st_clist_t *e, _st_clist_t *l)
{
e->next = l;
e->prev = l->prev;
l->prev->next = e;
l->prev = e;
}

void st_clist_insert_after(_st_clist_t *e, _st_clist_t *l)
{
e->next = l->next;
e->prev = l;
l->next->prev = e;
l->next = e;
}

void _st_switch_context(_st_thread_t *thread)
{
ST_SWITCH_OUT_CB(thread);
Expand Down
28 changes: 24 additions & 4 deletions trunk/3rdparty/st-srs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,36 @@ typedef struct _st_clist {
} _st_clist_t;

/* Initialize a circular list */
void st_clist_init(_st_clist_t *l);
inline void st_clist_init(_st_clist_t *l)
{
l->next = l;
l->prev = l;
}

/* Remove the element "_e" from it's circular list */
void st_clist_remove(_st_clist_t *e);
inline void st_clist_remove(_st_clist_t *e)
{
e->prev->next = e->next;
e->next->prev = e->prev;
}

/* Insert element "_e" into the list, before "_l" */
void st_clist_insert_before(_st_clist_t *e, _st_clist_t *l);
inline void st_clist_insert_before(_st_clist_t *e, _st_clist_t *l)
{
e->next = l;
e->prev = l->prev;
l->prev->next = e;
l->prev = e;
}

/* Insert element "_e" into the list, after "_l" */
void st_clist_insert_after(_st_clist_t *e, _st_clist_t *l);
inline void st_clist_insert_after(_st_clist_t *e, _st_clist_t *l)
{
e->next = l->next;
e->prev = l;
l->next->prev = e;
l->next = e;
}


/*****************************************
Expand Down

0 comments on commit 98ab8c1

Please sign in to comment.