]> granicus.if.org Git - graphviz/commitdiff
remove unused sfpoll()
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 10 Oct 2020 00:10:36 +0000 (17:10 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 16 Oct 2020 03:01:20 +0000 (20:01 -0700)
lib/sfio/Makefile.am
lib/sfio/sfio.h
lib/sfio/sfio.vcxproj
lib/sfio/sfio.vcxproj.filters
lib/sfio/sfpoll.c [deleted file]

index 7190a07f1e6c9b833a66b84cf9305b30bee29de9..5aaf37c390c42de6ecc6e2e148bad2eee191c5ec 100644 (file)
@@ -12,7 +12,7 @@ libsfio_C_la_SOURCES = sfclose.c sfcvt.c sfdisc.c \
        sfexcept.c sfexit.c sfextern.c sffilbuf.c \
        sfflsbuf.c \
        sfmode.c sfnew.c \
-       sfnputc.c sfopen.c sfpkrd.c sfpoll.c sfpool.c \
+       sfnputc.c sfopen.c sfpkrd.c sfpool.c \
        sfprintf.c sfprints.c sfpurge.c \
        sfputr.c sfraise.c sfrd.c sfread.c \
        sfresize.c sfscanf.c sfseek.c sfset.c sfsetbuf.c sfsetfd.c \
index 42df58ed0bccdafae8fcf2d0ed9150ccc8a2db56..d93f80c966460c0ad15f5450a37eae70c25f44b8 100644 (file)
@@ -295,7 +295,6 @@ extern "C" {
     extern Sfio_t *sfstack(Sfio_t *, Sfio_t *);
     extern Sfio_t *sfswap(Sfio_t *, Sfio_t *);
     extern int sfpurge(Sfio_t *);
-    extern int sfpoll(Sfio_t **, int, int);
     extern int sfsync(Sfio_t *);
     extern void *sfsetbuf(Sfio_t *, void *, size_t);
     extern Sfdisc_t *sfdisc(Sfio_t *, Sfdisc_t *);
index 7101d882b304afce59786d54fb6a25858a1b80c5..5d461af8c22eb892f807457a7d7aee278b6eab0c 100644 (file)
@@ -99,7 +99,6 @@
     <ClCompile Include="sfnputc.c" />
     <ClCompile Include="sfopen.c" />
     <ClCompile Include="sfpkrd.c" />
-    <ClCompile Include="sfpoll.c" />
     <ClCompile Include="sfpool.c" />
     <ClCompile Include="sfprintf.c" />
     <ClCompile Include="sfprints.c" />
index 06bd694973c9f6731a3620ae4477da4c155210a8..d6542634971e89465e6681d015a4343946f33083 100644 (file)
@@ -80,9 +80,6 @@
     <ClCompile Include="sfpkrd.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="sfpoll.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="sfpool.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/lib/sfio/sfpoll.c b/lib/sfio/sfpoll.c
deleted file mode 100644 (file)
index 90fd44e..0000000
+++ /dev/null
@@ -1,192 +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       <sfio/sfhdr.h>
-
-/*     Poll a set of streams to see if any is available for I/O.
-**     Ready streams are moved to front of array but retain the
-**     same relative order.
-**
-**     Written by Kiem-Phong Vo.
-*/
-
-/**
- * @param fa array of streams to poll
- * @param n number of streams in array
- * @param tm the amount of time in ms to wait for selecting
- */
-int sfpoll(Sfio_t ** fa, int n, int tm)
-{
-    int r, c, m;
-    Sfio_t *f;
-    Sfdisc_t *d;
-    int *status, *check;
-
-    if (n <= 0 || !fa)
-       return -1;
-
-    if (!(status = (int *) malloc(2 * n * sizeof(int))))
-       return -1;
-    else
-       check = status + n;
-
-    /* this loop partitions the streams into 3 sets: Check, Ready, Notready */
-  retry:for (r = c = 0; r < n; ++r) {
-       f = fa[r];
-
-       /* this loop pops a stream stack as necessary */
-       for (;;) {              /* check accessibility */
-           m = f->mode & SF_RDWR;
-           if ((int) f->mode != m && _sfmode(f, m, 0) < 0)
-               goto do_never;
-
-           /* clearly ready */
-           if (f->next < f->endb)
-               goto do_ready;
-
-           /* has discipline, ask its opinion */
-           for (d = f->disc; d; d = d->disc)
-               if (d->exceptf)
-                   break;
-           if (d) {
-               if ((m = (*d->exceptf) (f, SF_DPOLL, &tm, d)) < 0)
-                   goto do_never;
-               else if (m > 0)
-                   goto do_ready;
-               /*else check file descriptor */
-           }
-
-           /* unseekable stream, must check for blockability */
-           if (f->extent < 0)
-               goto do_check;
-
-           /* string/regular streams with no possibility of blocking */
-           if (!f->push)
-               goto do_ready;
-
-           /* stacked regular file stream with I/O possibility */
-           if (!(f->flags & SF_STRING) &&
-               ((f->mode & SF_WRITE) || f->here < f->extent))
-               goto do_ready;
-
-           /* at an apparent eof, pop stack if ok, then recheck */
-           SETLOCAL(f);
-           switch (_sfexcept(f, f->mode & SF_RDWR, 0, f->disc)) {
-           case SF_EDONE:
-               if (f->flags & SF_STRING)
-                   goto do_never;
-               else
-                   goto do_ready;
-           case SF_EDISC:
-               if (f->flags & SF_STRING)
-                   goto do_ready;
-           case SF_ESTACK:
-           case SF_ECONT:
-               continue;
-           }
-       }
-
-      do_check:                /* local function to set a stream for further checking */
-       {
-           status[r] = 0;
-           check[c] = r;
-           c += 1;
-           continue;
-       }
-
-      do_ready:                /* local function to set the ready streams */
-       {
-           status[r] = 1;
-           continue;
-       }
-
-      do_never:                /* local function to set the not-ready streams */
-       {
-           status[r] = -1;
-           continue;
-       }
-    }
-
-#ifdef HAVE_SELECT
-    if (c > 0) {
-       fd_set rd, wr;
-       struct timeval tmb, *tmp;
-
-       FD_ZERO(&rd);
-       FD_ZERO(&wr);
-       m = 0;
-       for (r = 0; r < c; ++r) {
-           f = fa[check[r]];
-           if (f->file > m)
-               m = f->file;
-           if (f->mode & SF_READ)
-               FD_SET(f->file, &rd);
-           else
-               FD_SET(f->file, &wr);
-       }
-       if (tm < 0)
-           tmp = NIL(struct timeval *);
-       else {
-           tmp = &tmb;
-           tmb.tv_sec = tm / SECOND;
-           tmb.tv_usec = (tm % SECOND) * SECOND;
-       }
-       for (;;) {
-           if ((r = select(m + 1, &rd, &wr, NIL(fd_set *), tmp)) == 0)
-               break;
-           else if (r < 0) {
-               if (errno == EINTR)
-                   continue;
-               else
-                   break;
-           }
-
-           for (r = 0; r < c; ++r) {
-               f = fa[check[r]];
-               if (((f->mode & SF_READ) && FD_ISSET(f->file, &rd)) ||
-                   ((f->mode & SF_WRITE) && FD_ISSET(f->file, &wr)))
-                   status[check[r]] = 1;
-           }
-           break;
-       }
-    }
-#endif /*HAVE_SELECT*/
-
-    /* call exception functions */
-    for (c = 0; c < n; ++c) {
-       if (status[c] <= 0)
-           continue;
-       if ((d = fa[c]->disc) && d->exceptf) {
-           if ((r = (*d->exceptf) (fa[c], SF_READY, (void *) 0, d)) < 0)
-               goto done;
-           else if (r > 0)
-               goto retry;
-       }
-    }
-
-    /* move ready streams to the front */
-    for (r = c = 0; c < n; ++c) {
-       if (status[c] > 0) {
-           if (c > r) {
-               f = fa[r];
-               fa[r] = fa[c];
-               fa[c] = f;
-           }
-           r += 1;
-       }
-    }
-
-  done:
-    free((void *) status);
-    return r;
-}