From d2d708cad59462bcd3a5966fd83edf22de37f6dc Mon Sep 17 00:00:00 2001 From: "alankila@bel.fi" Date: Fri, 9 Dec 2016 15:28:43 +0200 Subject: [PATCH] Remove unused code. Remove 'cutil/listio.cpp' and 'cutil/listio.h'. Also remove 'strsave' and 'strfree' defines from 'cutil/cutil.h'. --- cutil/Makefile.am | 4 +-- cutil/cutil.h | 20 -------------- cutil/listio.cpp | 67 ----------------------------------------------- cutil/listio.h | 43 ------------------------------ 4 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 cutil/listio.cpp delete mode 100644 cutil/listio.h diff --git a/cutil/Makefile.am b/cutil/Makefile.am index 15b339c8f3..5b0ffc6ebb 100644 --- a/cutil/Makefile.am +++ b/cutil/Makefile.am @@ -7,7 +7,7 @@ endif noinst_HEADERS = \ bitvec.h callcpp.h const.h cutil.h cutil_class.h danerror.h efio.h \ - emalloc.h freelist.h globals.h listio.h \ + emalloc.h freelist.h globals.h \ oldlist.h structures.h if !USING_MULTIPLELIBS @@ -22,7 +22,7 @@ endif libtesseract_cutil_la_SOURCES = \ bitvec.cpp callcpp.cpp cutil.cpp cutil_class.cpp danerror.cpp efio.cpp \ - emalloc.cpp freelist.cpp listio.cpp \ + emalloc.cpp freelist.cpp \ oldlist.cpp structures.cpp diff --git a/cutil/cutil.h b/cutil/cutil.h index 38b3ff9e39..42967093ab 100644 --- a/cutil/cutil.h +++ b/cutil/cutil.h @@ -92,26 +92,6 @@ typedef void (*void_dest) (void *); #define print_string(str) \ printf ("%s\n", str) -/********************************************************************** - * strfree - * - * Free the memory which was reserved by strsave. - **********************************************************************/ - -#define strfree(s) (free_string(s)) - -/********************************************************************** - * strsave - * - * Reserve a spot in memory for the string to be stored. Copy the string - * to it and return the result. - **********************************************************************/ - -#define strsave(s) \ - ((s) != NULL ? \ - ((char*) strcpy (alloc_string(strlen(s)+1), s)) : \ - (NULL)) - /*---------------------------------------------------------------------- F u n c t i o n s ----------------------------------------------------------------------*/ diff --git a/cutil/listio.cpp b/cutil/listio.cpp deleted file mode 100644 index 475088f5b5..0000000000 --- a/cutil/listio.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -*-C-*- -################################################################################ -# -# File: listio.c -# Description: List I/O processing procedures. -# Author: Mark Seaman, Software Productivity -# Created: Thu Jul 23 13:24:09 1987 -# Modified: Fri May 17 17:33:30 1991 (Mark Seaman) marks@hpgrlt -# Language: C -# Package: N/A -# Status: Reusable Software Component -# -# (c) Copyright 1987, Hewlett-Packard Company. -** 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. -# -################################################################################ - -This file contains the implementations of a set of general purpose -list I/O routines. For the interface definitions look in the file -"listio.h". ----------------------------------------------------------------------------*/ - -#include -#include -#include -#include "listio.h" - -/*--------------------------------------------------------------------------- - Public Function Code ----------------------------------------------------------------------------*/ -/************************************************************************* - * R E A D L I S T - * - * Read a list of strings from a file. Return the string list to the - * caller. - *************************************************************************/ -LIST read_list(const char *filename) { - FILE *infile; - char s[CHARS_PER_LINE]; - LIST list; - - if ((infile = open_file (filename, "r")) == NULL) - return (NIL_LIST); - - list = NIL_LIST; - while (fgets (s, CHARS_PER_LINE, infile) != NULL) { - s[CHARS_PER_LINE - 1] = '\0'; - if (strlen (s) > 0) { - if (s[strlen (s) - 1] == '\n') - s[strlen (s) - 1] = '\0'; - if (strlen (s) > 0) { - list = push (list, (LIST) strsave (s)); - } - } - } - - fclose(infile); - return (reverse_d (list)); -} diff --git a/cutil/listio.h b/cutil/listio.h deleted file mode 100644 index 7d9c19f777..0000000000 --- a/cutil/listio.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*-C-*- -################################################################################ -# -# File: listio.h -# Description: List I/O processing procedures. -# Author: Mark Seaman, Software Productivity -# Created: Thu Jul 23 13:24:09 1987 -# Modified: Mon Oct 16 11:38:52 1989 (Mark Seaman) marks@hpgrlt -# Language: C -# Package: N/A -# Status: Reusable Software Component -# -# (c) Copyright 1987, Hewlett-Packard Company. -** 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. -# -################################################################################ - * Revision 1.5 89/06/27 11:56:00 11:56:00 marks (Mark Seaman) - * Fixed MAC_OR_DOS bug - * - - This file contains the interface definitions to a set of general purpose - list I/O routines. - -***********************************************************************/ -#ifndef LISTIO_H -#define LISTIO_H - -#include -#include "oldlist.h" - -/*---------------------------------------------------------------------------- - Public Function Prototypes ---------------------------------------------------------------------------*/ -LIST read_list(const char *filename); -#endif