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

📄 memory.h

📁 UNIX、linux密码的破密程序源代码实现
💻 H
字号:
/* * This file is part of John the Ripper password cracker, * Copyright (c) 1996-98,2003 by Solar Designer *//* * Memory allocation routines. */#ifndef _JOHN_MEMORY_H#define _JOHN_MEMORY_H#include <stdio.h>#include <stdlib.h>#include "arch.h"/* * Standard alignments for mem_alloc_tiny(). */#define MEM_ALIGN_NONE			1#define MEM_ALIGN_WORD			ARCH_SIZE#define MEM_ALIGN_CACHE			(ARCH_SIZE * 8)/* * Block size used by mem_alloc_tiny(). */#define MEM_ALLOC_SIZE			0x10000/* * Use mem_alloc() instead of allocating a new block in mem_alloc_tiny() * if more than MEM_ALLOC_MAX bytes would be lost. */#define MEM_ALLOC_MAX			0x400/* * Memory saving level, setting this high enough disables alignments (if the * architecture allows). */extern unsigned int mem_saving_level;/* * Allocates size bytes and returns a pointer to the allocated memory. * If an error occurs, the function does not return. */extern void *mem_alloc(size_t size);/* * Frees memory allocated with mem_alloc() and sets the pointer to NULL. * Does nothing if the pointer is already NULL. */#define MEM_FREE(ptr) \{ \	if ((ptr)) { \		free((ptr)); \		(ptr) = NULL; \	} \}/* * Similar to the above function, except the memory can't be freed. * This one is used to reduce the overhead. */extern void *mem_alloc_tiny(size_t size, size_t align);/* * Uses mem_alloc_tiny() to allocate the memory, and copies src in there. */extern void *mem_alloc_copy(size_t size, size_t align, void *src);/* * Similar to the above function, but for ASCIIZ strings. */extern char *str_alloc_copy(char *src);#endif

⌨️ 快捷键说明

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