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