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

📄 collectn.c

📁 开源的nasm编译器源码,研究编译器原理很有帮且
💻 C
字号:
/* collectn.c	Implements variable length pointer arrays [collections] * * This file is public domain. */#include "collectn.h"#include <stdlib.h>void collection_init(Collection * c){  int i;  for (i = 0; i < 32; i++) c->p[i] = NULL;  c->next = NULL;}void ** colln(Collection * c, int index){  while (index >= 32) {    index -= 32;    if (c->next == NULL) {      c->next = malloc(sizeof(Collection));      collection_init(c->next);    }    c = c->next;  }  return &(c->p[index]);}void collection_reset(Collection *c){  int i;  if (c->next) {    collection_reset(c->next);    free(c->next);  }  c->next = NULL;  for (i = 0; i < 32; i++) c->p[i] = NULL;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -