⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ospfh_vector.c

📁 实现禁位自动排列在禁位中具体实现了此方法所以这是一个创新很有应用价值在VC平台上调试通过
💻 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 + -