From 5548b5ffae970797ac13496e29d5e04c34c8bd8b Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 30 Sep 2020 17:40:56 -0700 Subject: [PATCH] remove unused sfclrlock() --- lib/sfio/Makefile.am | 2 +- lib/sfio/sfclrlock.c | 50 ----------------------------------- lib/sfio/sfhdr.h | 9 ------- lib/sfio/sfio.h | 1 - lib/sfio/sfio.vcxproj | 1 - lib/sfio/sfio.vcxproj.filters | 3 --- 6 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 lib/sfio/sfclrlock.c diff --git a/lib/sfio/Makefile.am b/lib/sfio/Makefile.am index bc74569a9..a1fd68ee9 100644 --- a/lib/sfio/Makefile.am +++ b/lib/sfio/Makefile.am @@ -8,7 +8,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib noinst_HEADERS = sfhdr.h sfio.h sfio_t.h vthread.h noinst_LTLIBRARIES = libsfio_C.la -libsfio_C_la_SOURCES = sfclose.c sfclrlock.c sfcvt.c sfdisc.c \ +libsfio_C_la_SOURCES = sfclose.c sfcvt.c sfdisc.c \ sfexcept.c sfexit.c sfextern.c sffilbuf.c \ sfflsbuf.c sfgetd.c sfgetl.c sfgetm.c sfgetr.c sfgetu.c \ sfmode.c sfnew.c sfnotify.c \ diff --git a/lib/sfio/sfclrlock.c b/lib/sfio/sfclrlock.c deleted file mode 100644 index 3a7fa56dc..000000000 --- a/lib/sfio/sfclrlock.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $Id$ $Revision$ */ -/* vim:set shiftwidth=4 ts=8: */ - -/************************************************************************* - * Copyright (c) 2011 AT&T Intellectual Property - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: See CVS logs. Details at http://www.graphviz.org/ - *************************************************************************/ - -#include - -/* Function to clear a locked stream. -** This is useful for programs that longjmp from the mid of an sfio function. -** There is no guarantee on data integrity in such a case. -** -** Written by Kiem-Phong Vo -*/ -int sfclrlock(Sfio_t * f) -{ - int rv; - - /* already closed */ - if (f && (f->mode & SF_AVAIL)) - return 0; - - SFMTXSTART(f, 0); - - /* clear error bits */ - f->flags &= (unsigned short)~(SF_ERROR | SF_EOF); - - /* clear peek locks */ - if (f->mode & SF_PKRD) { - f->here -= f->endb - f->next; - f->endb = f->next; - } - - SFCLRBITS(f); - - /* throw away all lock bits except for stacking state SF_PUSH */ - f->mode &= - (SF_RDWR | SF_INIT | SF_POOL | SF_PUSH | SF_SYNCED | SF_STDIO); - - rv = (f->mode & SF_PUSH) ? 0 : (f->flags & SF_FLAGS); - - SFMTXRETURN(f, rv); -} diff --git a/lib/sfio/sfhdr.h b/lib/sfio/sfhdr.h index cf2169e9a..625da9bc2 100644 --- a/lib/sfio/sfhdr.h +++ b/lib/sfio/sfhdr.h @@ -146,13 +146,7 @@ extern "C" { /* on closing, don't be a hero about reread/rewrite on interrupts */ #define SF_ENDING 00000400 -/* private flags that must be cleared in sfclrlock */ #define SF_DCDOWN 00001000 /* recurse down the discipline stack */ -#define SF_MVSIZE 00002000 -#define SFMVSET(f) (((f)->size *= SF_NMAP), ((f)->bits |= SF_MVSIZE) ) -#define SFMVUNSET(f) (!((f)->bits&SF_MVSIZE) ? 0 : \ - (((f)->bits &= (unsigned short)~SF_MVSIZE), ((f)->size /= SF_NMAP)) ) -#define SFCLRBITS(f) (SFMVUNSET(f), ((f)->bits &= (unsigned short)~(SF_DCDOWN|SF_MVSIZE)) ) /* bits for the mode field, SF_INIT defined in sfio_t.h */ #define SF_RC 00000010u /* peeking for a record */ @@ -457,9 +451,6 @@ extern "C" { #define SFDIRECT(f,n) (((ssize_t)(n) >= (f)->size) || \ ((n) >= SF_GRAIN && (ssize_t)(n) >= (f)->size/16 ) ) -/* number of pages to memory map at a time */ -#define SF_NMAP 8 - /* the bottomless bit bucket */ #define DEVNULL "/dev/null" #define SFSETNULL(f) ((f)->extent = (Sfoff_t)(-1), (f)->bits |= SF_NULL) diff --git a/lib/sfio/sfio.h b/lib/sfio/sfio.h index 58bd639ca..ca6af9f49 100644 --- a/lib/sfio/sfio.h +++ b/lib/sfio/sfio.h @@ -302,7 +302,6 @@ extern "C" { extern int sfpoll(Sfio_t **, int, int); extern void *sfreserve(Sfio_t *, ssize_t, int); extern int sfsync(Sfio_t *); - extern int sfclrlock(Sfio_t *); extern void *sfsetbuf(Sfio_t *, void *, size_t); extern Sfdisc_t *sfdisc(Sfio_t *, Sfdisc_t *); extern int sfraise(Sfio_t *, int, void *); diff --git a/lib/sfio/sfio.vcxproj b/lib/sfio/sfio.vcxproj index 3a72d7919..50faec2ab 100644 --- a/lib/sfio/sfio.vcxproj +++ b/lib/sfio/sfio.vcxproj @@ -83,7 +83,6 @@ - diff --git a/lib/sfio/sfio.vcxproj.filters b/lib/sfio/sfio.vcxproj.filters index ad6dacb09..d0c74ffc0 100644 --- a/lib/sfio/sfio.vcxproj.filters +++ b/lib/sfio/sfio.vcxproj.filters @@ -44,9 +44,6 @@ Source Files - - Source Files - Source Files -- 2.40.0