↩ revert:
This commit is contained in:
@@ -25,7 +25,7 @@ struct mytbf_st
|
||||
int pos;
|
||||
};
|
||||
|
||||
static struct mytbf_st* job[MYTBF_MAX];
|
||||
static struct mytbf_st *job[MYTBF_MAX];
|
||||
static int inited = 0;
|
||||
static __sighandler_t alrm_handler_save; //!!! 保存原来的alarm行为
|
||||
|
||||
@@ -78,9 +78,9 @@ static void module_load( )
|
||||
atexit(module_unload); //!!! atexit()
|
||||
}
|
||||
|
||||
mytbf_t* mytbf_init(int cps, int burst)
|
||||
mytbf_t *mytbf_init(int cps, int burst)
|
||||
{
|
||||
struct mytbf_st* me;
|
||||
struct mytbf_st *me;
|
||||
int pos;
|
||||
|
||||
if (!inited)
|
||||
@@ -112,12 +112,12 @@ static int min(int a, int b)
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
int mytbf_fetchtoken(mytbf_t* ptr, int size)
|
||||
int mytbf_fetchtoken(mytbf_t *ptr, int size)
|
||||
{
|
||||
if (size <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
struct mytbf_st* me = ptr;
|
||||
struct mytbf_st *me = ptr;
|
||||
int n;
|
||||
|
||||
while (me->token <= 0)
|
||||
@@ -130,12 +130,12 @@ int mytbf_fetchtoken(mytbf_t* ptr, int size)
|
||||
return n;
|
||||
}
|
||||
|
||||
int mytbf_returntoken(mytbf_t* ptr, int size)
|
||||
int mytbf_returntoken(mytbf_t *ptr, int size)
|
||||
{
|
||||
if (size <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
struct mytbf_st* me = ptr;
|
||||
struct mytbf_st *me = ptr;
|
||||
|
||||
me->token += size;
|
||||
if (me->token > me->burst)
|
||||
@@ -144,9 +144,9 @@ int mytbf_returntoken(mytbf_t* ptr, int size)
|
||||
return size;
|
||||
}
|
||||
|
||||
int mytbf_destroy(mytbf_t* ptr)
|
||||
int mytbf_destroy(mytbf_t *ptr)
|
||||
{
|
||||
struct mytbf_st* me = ptr;
|
||||
struct mytbf_st *me = ptr;
|
||||
|
||||
job[me->pos] = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user