?? utils.c
字號:
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <errno.h>//////////////////////////////////////////////////////////////////////// Utils functions//////////////////////////////////////////////////////////////////////char *safe_malloc(int size){ char *p = NULL; int retry = 5; while (retry > 0 && ((p = malloc(size)) == NULL)) { fprintf(stderr, "malloc() failed: %s\n", strerror(errno)); sleep(1); retry--; } return p;}void safe_free(void *p){ if (p) { fprintf(stdout, "DEBUG: try to free %p\n", p); free(p); p = NULL; } p = NULL;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -