📄 ospfh_vector.c
字号:
/*ospf_vector.c*/
#include "ospfh.h"
#include "ospfh_patch.h"
struct vector*
vector_init (unsigned int size)
{
struct vector *v = XMALLOC (1, sizeof (struct vector));
/* allocate at least one slot */
if (size == 0)
size = 1;
v->alloced = size;
v->max = 0;
v->index = XMALLOC (1, sizeof (char *) * size);
return v;
}
int
vector_empty_slot (struct vector *v)
{
return v->max;
}
/* Set value to the smallest empty slot. */
int
vector_set (struct vector *v, char *val)
{
unsigned int i;
i = vector_empty_slot (v);
v->index[i] = val;
v->max ++;
return i;
}
void
vector_free (struct vector* v)
{
XFREE (1, v->index);
XFREE (1, v);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -