mm.true.c
来自「斯坦福大学密码学家Boneh的基于身份的公钥密码系统」· C语言 代码 · 共 48 行
C
48 行
/* keep track of memory use * Ben Lynn *//*Copyright (C) 2001 Benjamin Lynn (blynn@cs.stanford.edu)See LICENSE for license*/#include <stdio.h>#include <stdlib.h>#include "mm.h"struct mm_s { int count; char name[100];};static struct mm_s mmtable[1000];static int mmcount = 0;void mm_tally(char *s, int n, char *reason){ int i; for (i=0; i<mmcount; i++) { if (!strcmp(mmtable[i].name, s)) break; } if (i == mmcount) { mmcount++; strcpy(mmtable[i].name, s); } mmtable[i].count += n; //fprintf(stderr, "mm: %s: %s: %d: %d\n", s, reason, n, mmtable[i].count);}void mm_report(){ int i; for (i=0; i<mmcount; i++) { fprintf(stderr, "%s: %d\n", mmtable[i].name, mmtable[i].count); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?