mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-07 09:52:40 +08:00
modernise cutil/emalloc.cpp
This commit is contained in:
parent
52e4c77df8
commit
2a1cba6223
@ -1,13 +1,13 @@
|
||||
/******************************************************************************
|
||||
** Filename:
|
||||
/**************************************************************************
|
||||
* Filename:
|
||||
emalloc.c
|
||||
** Purpose:
|
||||
** Purpose:
|
||||
Routines for trapping memory allocation errors.
|
||||
** Author:
|
||||
** Author:
|
||||
Dan Johnson
|
||||
HP-UX 6.2
|
||||
HP-UX 6.2
|
||||
** History:
|
||||
** History:
|
||||
4/3/89, DSJ, Created.
|
||||
**
|
||||
** (c) Copyright Hewlett-Packard Company, 1988.
|
||||
@ -21,36 +21,30 @@
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
******************************************************************************/
|
||||
/**----------------------------------------------------------------------------
|
||||
/*----------------------------------------------------------------------------
|
||||
Include Files and Type Defines
|
||||
----------------------------------------------------------------------------**/
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "emalloc.h"
|
||||
#include "danerror.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
/**----------------------------------------------------------------------------
|
||||
/*----------------------------------------------------------------------------
|
||||
Public Code
|
||||
----------------------------------------------------------------------------**/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void *Emalloc(int Size) {
|
||||
/*
|
||||
** Parameters:
|
||||
** Size
|
||||
number of bytes of memory to be allocated
|
||||
** Globals: none
|
||||
** Operation:
|
||||
** This routine attempts to allocate the specified number of
|
||||
** bytes. If the memory can be allocated, a pointer to the
|
||||
** memory is returned. If the memory cannot be allocated, or
|
||||
** if the allocation request is negative or zero,
|
||||
** an error is trapped.
|
||||
** Return: Pointer to allocated memory.
|
||||
** Exceptions: NOTENOUGHMEMORY
|
||||
unable to allocate Size bytes
|
||||
** ILLEGALMALLOCREQUEST
|
||||
negative or zero request size
|
||||
** History: 4/3/89, DSJ, Created.
|
||||
----------------------------------------------------------------------------*/
|
||||
/**
|
||||
* This routine attempts to allocate the specified number of
|
||||
* bytes. If the memory can be allocated, a pointer to the
|
||||
* memory is returned. If the memory cannot be allocated, or
|
||||
* if the allocation request is negative or zero,
|
||||
* an error is trapped.
|
||||
* @param Size number of bytes of memory to be allocated
|
||||
* @return Pointer to allocated memory.
|
||||
* @note Exceptions:
|
||||
* - #NOTENOUGHMEMORY unable to allocate Size bytes
|
||||
* - #ILLEGALMALLOCREQUEST negative or zero request size
|
||||
* @note History: 4/3/89, DSJ, Created.
|
||||
*/
|
||||
void *Emalloc(int Size) {
|
||||
void *Buffer;
|
||||
|
||||
if (Size <= 0)
|
||||
|
Loading…
Reference in New Issue
Block a user