From db7f2009d9266890e5fd6a0cf963fbdeb3c28169 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 25 Jun 2018 15:47:59 +0200 Subject: [PATCH] Remove memry.cpp, memry.h The proprietary memory allocators alloc_string, alloc_mem are no longer used. Signed-off-by: Stefan Weil --- src/ccutil/Makefile.am | 4 ++-- src/ccutil/memry.cpp | 45 ------------------------------------------ src/ccutil/memry.h | 34 ------------------------------- 3 files changed, 2 insertions(+), 81 deletions(-) delete mode 100644 src/ccutil/memry.cpp delete mode 100644 src/ccutil/memry.h diff --git a/src/ccutil/Makefile.am b/src/ccutil/Makefile.am index 976d11b4c5..5fa6668771 100644 --- a/src/ccutil/Makefile.am +++ b/src/ccutil/Makefile.am @@ -19,7 +19,7 @@ pkginclude_HEADERS = \ noinst_HEADERS = \ ambigs.h basedir.h bits16.h bitvector.h ccutil.h clst.h doubleptr.h elst2.h \ elst.h errcode.h fileerr.h genericheap.h globaloc.h \ - indexmapbidi.h kdpair.h lsterr.h memry.h \ + indexmapbidi.h kdpair.h lsterr.h \ nwmain.h object_cache.h params.h qrsequence.h sorthelper.h stderr.h \ scanutils.h tessdatamanager.h tprintf.h \ unicharcompress.h unicharmap.h unicharset.h unicity_table.h unicodes.h \ @@ -32,7 +32,7 @@ libtesseract_ccutil_la_SOURCES = \ ccutil.cpp clst.cpp \ elst2.cpp elst.cpp errcode.cpp \ globaloc.cpp indexmapbidi.cpp \ - mainblk.cpp memry.cpp \ + mainblk.cpp \ serialis.cpp strngs.cpp scanutils.cpp \ tessdatamanager.cpp tprintf.cpp \ unichar.cpp unicharcompress.cpp unicharmap.cpp unicharset.cpp unicodes.cpp \ diff --git a/src/ccutil/memry.cpp b/src/ccutil/memry.cpp deleted file mode 100644 index 1cab424aa7..0000000000 --- a/src/ccutil/memry.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/********************************************************************** - * File: memry.cpp (Formerly memory.c) - * Description: Memory allocation with builtin safety checks. - * Author: Ray Smith - * Created: Wed Jan 22 09:43:33 GMT 1992 - * - * (C) Copyright 1992, Hewlett-Packard Ltd. - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** http://www.apache.org/licenses/LICENSE-2.0 - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - * - **********************************************************************/ - -#include "memry.h" -#include - -// With improvements in OS memory allocators, internal memory management -// is no longer required, so all these functions now map to their malloc -// family equivalents. - -// TODO(rays) further cleanup by redirecting calls to new and creating proper -// constructors. - -char *alloc_string(int32_t count) { - // Round up the amount allocated to a multiple of 4 - return static_cast(malloc((count + 3) & ~3)); -} - -void free_string(char *string) { - free(string); -} - -void *alloc_mem(int32_t count) { - return malloc(static_cast(count)); -} - -void free_mem(void *oldchunk) { - free(oldchunk); -} diff --git a/src/ccutil/memry.h b/src/ccutil/memry.h deleted file mode 100644 index 34e01dc0b3..0000000000 --- a/src/ccutil/memry.h +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************************** - * File: memry.h (Formerly memory.h) - * Description: Header file for basic memory allocation/deallocation. - * Author: Ray Smith - * Created: Tue May 8 16:03:48 BST 1990 - * - * (C) Copyright 1990, Hewlett-Packard Ltd. - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** http://www.apache.org/licenses/LICENSE-2.0 - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - * - **********************************************************************/ - -#ifndef MEMRY_H -#define MEMRY_H - -#include - -// allocate string -extern char *alloc_string(int32_t count); -// free a string. -extern void free_string(char *string); -// get some memory -extern void *alloc_mem(int32_t count); -// free mem from alloc_mem -extern void free_mem(void *oldchunk); - -#endif