]> granicus.if.org Git - graphviz/commitdiff
remove unused sfgetr()
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 1 Oct 2020 00:54:22 +0000 (17:54 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 7 Oct 2020 03:08:02 +0000 (20:08 -0700)
lib/sfio/Makefile.am
lib/sfio/sfgetr.c [deleted file]
lib/sfio/sfio.h
lib/sfio/sfio.vcxproj
lib/sfio/sfio.vcxproj.filters
lib/sfio/sfmode.c

index 060289f386e7d17b0db10dd829fb9ae2143022c3..9f58bda39abb9a2ac9042a21bcae20e1913e7bc0 100644 (file)
@@ -10,7 +10,7 @@ noinst_LTLIBRARIES = libsfio_C.la
 
 libsfio_C_la_SOURCES = sfclose.c sfcvt.c sfdisc.c \
        sfexcept.c sfexit.c sfextern.c sffilbuf.c \
-       sfflsbuf.c sfgetm.c sfgetr.c sfgetu.c \
+       sfflsbuf.c sfgetm.c sfgetu.c \
        sfmode.c sfnew.c sfnotify.c \
        sfnputc.c sfopen.c sfpkrd.c sfpoll.c sfpool.c \
        sfprintf.c sfprints.c sfpurge.c \
diff --git a/lib/sfio/sfgetr.c b/lib/sfio/sfgetr.c
deleted file mode 100644 (file)
index 5a3b640..0000000
+++ /dev/null
@@ -1,136 +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>
-
-/*     Read a record delineated by a character.
-**     The record length can be accessed via sfvalue(f).
-**
-**     Written by Kiem-Phong Vo
-*/
-
-/**
- * @param f stream to read from. r11 on vax
- * @param rc record separator. r10 on Vax
- * @param type
- */
-char *sfgetr(Sfio_t * f, int rc, int type)
-{
-    ssize_t n;
-    uchar *s, *ends, *us;
-    ssize_t un;
-    int found;
-    Sfrsrv_t *rsrv;
-
-    SFMTXSTART(f, NIL(char *));
-
-    if (rc < 0 || (f->mode != SF_READ && _sfmode(f, SF_READ, 0) < 0))
-       SFMTXRETURN(f, NIL(char *));
-    SFLOCK(f, 0);
-
-    /* buffer to be returned */
-    rsrv = NIL(Sfrsrv_t *);
-    us = NIL(uchar *);
-    un = 0;
-    found = 0;
-
-    /* compatibility mode */
-    type = type < 0 ? SF_LASTR : type == 1 ? SF_STRING : type;
-
-    if (type & SF_LASTR) {     /* return the broken record */
-       if ((rsrv = f->rsrv) && (un = -rsrv->slen) > 0) {
-           us = rsrv->data;
-           found = 1;
-       }
-       goto done;
-    }
-
-    while (!found) {           /* fill buffer if necessary */
-       if ((n = (ends = f->endb) - (s = f->next)) <= 0) {      /* for unseekable devices, peek-read 1 record */
-           f->getr = rc;
-           f->mode |= SF_RC;
-
-           /* fill buffer the conventional way */
-           if (SFRPEEK(f, s, n) <= 0) {
-               us = NIL(uchar *);
-               goto done;
-           } else {
-               ends = s + n;
-               if (f->mode & SF_RC) {
-                   s = ends[-1] == rc ? ends - 1 : ends;
-                   goto do_copy;
-               }
-           }
-       }
-       if (!(s = (uchar *) memchr((char *) s, rc, n)))
-           s = ends;
-      do_copy:
-       if (s < ends) {
-           s += 1;             /* include the separator */
-           found = 1;
-
-           if (!us && (!(type & SF_STRING) || !(f->flags & SF_STRING) || ((f->flags & SF_STRING) && (f->bits & SF_BOTH)))) {   /* returning data in buffer */
-               us = f->next;
-               un = s - f->next;
-               f->next = s;
-               goto done;
-           }
-       }
-
-       /* amount to be read */
-       n = s - f->next;
-
-       /* get internal buffer */
-       if (!rsrv || rsrv->size < un + n + 1) {
-           if (rsrv)
-               rsrv->slen = un;
-           if ((rsrv = _sfrsrv(f, un + n + 1)) != NIL(Sfrsrv_t *))
-               us = rsrv->data;
-           else {
-               us = NIL(uchar *);
-               goto done;
-           }
-       }
-
-       /* now copy data */
-       s = us + un;
-       un += n;
-       ends = f->next;
-       f->next += n;
-       MEMCPY(s, ends, n);
-    }
-
-  done:
-    _Sfi = f->val = un;
-    f->getr = 0;
-    if (found && rc != 0 && (type & SF_STRING)) {
-       us[un - 1] = '\0';
-       if (us >= f->data && us < f->endb) {
-           f->getr = rc;
-           f->mode |= SF_GETR;
-       }
-    }
-
-    /* prepare for a call to get the broken record */
-    if (rsrv)
-       rsrv->slen = found ? 0 : -un;
-
-    SFOPEN(f, 0);
-
-    if (us && (type & SF_LOCKR)) {
-       f->mode |= SF_PEEK | SF_GETR;
-       f->endr = f->data;
-    }
-
-    SFMTXRETURN(f, (char *) us);
-}
index 81329fca47d4dc7311e457187022a9576fd5f0c6..7af42f8560bda1b96e58d1263b92079a9944b649 100644 (file)
@@ -230,7 +230,7 @@ extern "C" {
 #define SF_BUFCONST    0400000 /* unused flag - for compatibility only */
 #endif
 
-/* for sfgetr/sfreserve to hold a record */
+/* for sfreserve to hold a record */
 #define SF_LOCKR       0000010 /* lock record, stop access to stream   */
 #define SF_LASTR       0000020 /* get the last incomplete record       */
 
@@ -315,7 +315,6 @@ extern "C" {
     extern Sfoff_t sftell(Sfio_t *);
     extern Sfoff_t sfseek(Sfio_t *, Sfoff_t, int);
     extern ssize_t sfputr(Sfio_t *, const char *, int);
-    extern char *sfgetr(Sfio_t *, int, int);
     extern ssize_t sfnputc(Sfio_t *, int, size_t);
     extern int sfungetc(Sfio_t *, int);
     extern int sfprintf(Sfio_t *, const char *, ...);
index bbd420020a6ac4c1f8a97ac3d2c1b1c51d502597..63d9be8180902bff5ebd2b9fa0327a4560b6e5e5 100644 (file)
@@ -91,7 +91,6 @@
     <ClCompile Include="sffilbuf.c" />
     <ClCompile Include="sfflsbuf.c" />
     <ClCompile Include="sfgetm.c" />
-    <ClCompile Include="sfgetr.c" />
     <ClCompile Include="sfgetu.c" />
     <ClCompile Include="sfio_f\_sffileno.c" />
     <ClCompile Include="sfio_f\_sfgetc.c" />
index 492ce2e5f55dedda443a2261ae5b29f85b1b9892..57c34bdfadaddbfebd444beeac358c956cff3bc6 100644 (file)
@@ -68,9 +68,6 @@
     <ClCompile Include="sfgetm.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="sfgetr.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="sfgetu.c">
       <Filter>Source Files</Filter>
     </ClCompile>
index 4045dd867d57a2144fed9beac36c795f74705e7e..b3fd5ff12b2ef78348850c888ac55303a5aaa96c 100644 (file)
@@ -133,7 +133,7 @@ int _sfsetpool(Sfio_t * f)
     POOLMTXRETURN(p, rv);
 }
 
-/* create an auxiliary buffer for sfgetr/sfreserve/sfputr */
+/* create an auxiliary buffer for sfreserve/sfputr */
 Sfrsrv_t *_sfrsrv(Sfio_t * f, ssize_t size)
 {
     Sfrsrv_t *rsrv, *rs;