]> granicus.if.org Git - graphviz/commitdiff
Remove unused code from cgraph: sfdcio
authorErwin Janssen <erwinjanssen@outlook.com>
Sat, 24 Sep 2016 12:42:16 +0000 (14:42 +0200)
committerErwin Janssen <erwinjanssen@outlook.com>
Tue, 4 Oct 2016 14:06:46 +0000 (16:06 +0200)
This function is never used somewhere. Removed the function declaration from sfdisc.h and the file containing the definition.
The define `HAVE_STRUCT_DIOATTR` was only used in this code file, so the check setting this define in `configure.ac` can also be removed.

config.iffe
configure.ac
lib/sfio/Sfio_dc/Makefile.am
lib/sfio/Sfio_dc/sfdcdio.c [deleted file]
lib/sfio/Sfio_dc/sfdisc.h
windows/include/config.h

index b053b145386fa13ffb336e1e883691c848978b28..9a19b23d46ec3b8f9bf9d92dc892db387d92a3d5 100644 (file)
@@ -105,16 +105,6 @@ compile{
 #define HAVE_ICONV_T_DEF 1
 }end
 
-compile{
-    #include <sys/types.h>
-    #include <fcntl.h>
-    #include <stdio.h>
-    struct dioattr  xx; 
-}end yes{
-/* Define if you have struct dioattr in <sys/fcntl.h>. */
-#define HAVE_STRUCT_DIOATTR 1
-}end
-
 compile{
     #include <fenv.h>
     void foo() {fesetenv (FE_NONIEEE_ENV);} 
index fc3a246bb3ea384a13e60ae728fd0fcc41895bd4..d7cca6274f0f8de04d1ce30e5243f84c613ff396 100644 (file)
@@ -438,18 +438,6 @@ AC_HEADER_STDBOOL
 # Internationalization macros
 # AM_GNU_GETTEXT
 
-# -----------------------------------
-# Test for direct I/O
-AC_MSG_CHECKING([for struct dioattr])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#include <fcntl.h>
-#include <stdio.h>]], [[
-struct dioattr dio;]])],[
-AC_MSG_RESULT(yes)
-AC_DEFINE(HAVE_STRUCT_DIOATTR, 1,
-[Define to 1 if you have struct dioattr])],[
-AC_MSG_RESULT(no)])
-
 dnl -----------------------------------
 dnl Checks for -lm library
 
index a57a50e9611d5539f7f1dc5fa751c23b7b8ab0d5..5a8e559549fda70791efee8b8cc791716be45013 100644 (file)
@@ -6,7 +6,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib/sfio
 noinst_HEADERS = sfdchdr.h sfdisc.h
 noinst_LTLIBRARIES = libsfiodc_C.la
 
-libsfiodc_C_la_SOURCES = sfdcdio.c sfdcdos.c sfdcfilter.c sfdclzw.c \
+libsfiodc_C_la_SOURCES = sfdcdos.c sfdcfilter.c sfdclzw.c \
        sfdcseekable.c sfdcslow.c sfdcsubstream.c sfdctee.c sfdcunion.c
 
 ${top_builddir}/FEATURE/sfio:  ${top_srcdir}/lib/sfio/features/sfio
diff --git a/lib/sfio/Sfio_dc/sfdcdio.c b/lib/sfio/Sfio_dc/sfdcdio.c
deleted file mode 100644 (file)
index 80aeeaf..0000000
+++ /dev/null
@@ -1,177 +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       "sfdchdr.h"
-
-/*     Discipline to turn on direct IO capability.
-**     This currently only works for XFS on SGI's.
-**
-**     Written by Kiem-Phong Vo, kpv@research.att.com, 03/18/1998.
-*/
-
-typedef struct _direct_s {
-    Sfdisc_t disc;             /* Sfio discipline      */
-    int cntl;                  /* file control flags   */
-#ifdef HAVE_STRUCT_DIOATTR
-    struct dioattr dio;                /* direct IO params     */
-#endif
-} Direct_t;
-
-/* convert a pointer to an int */
-#define P2I(p) (Sfulong_t)((char*)(p) - (char*)0)
-
-#ifdef HAVE_STRUCT_DIOATTR
-static ssize_t diordwr(Sfio_t * f, void * buf, size_t n, Direct_t * di,
-                      int type)
-{
-    size_t rw, done;
-    ssize_t rv = 0;
-
-    done = 0;                  /* amount processed by direct IO */
-
-    if ((P2I(buf) % di->dio.d_mem) == 0 && (f->here % di->dio.d_miniosz) == 0 && n >= di->dio.d_miniosz) {     /* direct IO ok, make sure we're in the right mode */
-       if (!(di->cntl & FDIRECT)) {
-           di->cntl |= FDIRECT;
-           (void) fcntl(f->file, F_SETFL, di->cntl);
-       }
-
-       for (rw = (n / di->dio.d_miniosz) * di->dio.d_miniosz;;) {
-           size_t io;
-
-           if ((io = rw) > di->dio.d_maxiosz)
-               io = di->dio.d_maxiosz;
-           if (type == SF_READ)
-               rv = read(f->file, buf, io);
-           else
-               rv = write(f->file, buf, io);
-
-           if (rv > 0) {
-               rw -= rv;
-               done += rv;
-               buf = (void *) ((char *) buf + rv);
-           }
-
-           if (rv < io || rw < di->dio.d_miniosz)
-               break;
-       }
-    }
-
-    if (done < n && (di->cntl & FDIRECT)) {    /* turn off directIO for remaining IO operation */
-       di->cntl &= ~FDIRECT;
-       (void) fcntl(f->file, F_SETFL, di->cntl);
-    }
-
-    if ((rw = n - done) > 0 &&
-       (rv =
-        type == SF_READ ? read(f->file, buf, rw) : write(f->file, buf,
-                                                         rw)) > 0)
-       done += rv;
-
-    return done ? done : rv;
-}
-
-static ssize_t dioread(Sfio_t * f, void * buf, size_t n, Sfdisc_t * disc)
-{
-    return diordwr(f, buf, n, (Direct_t *) disc, SF_READ);
-}
-
-static ssize_t diowrite(Sfio_t * f, const void * buf, size_t n,
-                       Sfdisc_t * disc)
-{
-    return diordwr(f, (void *) buf, n, (Direct_t *) disc, SF_WRITE);
-}
-
-static int dioexcept(Sfio_t * f, int type, void * data, Sfdisc_t * disc)
-{
-    Direct_t *di = (Direct_t *) disc;
-
-    if (type == SF_FINAL || type == SF_DPOP) {
-       if (di->cntl & FDIRECT) {
-           di->cntl &= ~FDIRECT;
-           (void) fcntl(f->file, F_SETFL, di->cntl);
-       }
-       free(disc);
-    }
-
-    return 0;
-}
-#endif                         /*HAVE_STRUCT_DIOATTR */
-
-int sfdcdio(Sfio_t * f, size_t bufsize)
-{
-#ifndef HAVE_STRUCT_DIOATTR
-    return -1;
-#else
-    int cntl;
-    struct dioattr dio;
-    void *buf;
-    Direct_t *di;
-
-    if (f->extent < 0 || (f->flags & SF_STRING))
-       return -1;
-
-    if ((cntl = fcntl(f->file, F_GETFL, 0)) < 0)
-       return -1;
-
-    if (!(cntl & FDIRECT)) {
-       cntl |= FDIRECT;
-       if (fcntl(f->file, F_SETFL, cntl) < 0)
-           return -1;
-    }
-
-    if (fcntl(f->file, F_DIOINFO, &dio) < 0)
-       goto no_direct;
-
-    if (bufsize > 0)
-       bufsize = (bufsize / dio.d_miniosz) * dio.d_miniosz;
-    if (bufsize <= 0)
-       bufsize = dio.d_miniosz * 64;
-    if (bufsize > dio.d_maxiosz)
-       bufsize = dio.d_maxiosz;
-
-    if (!(di = (Direct_t *) malloc(sizeof(Direct_t))))
-       goto no_direct;
-
-    if (!(buf = (void *) memalign(dio.d_mem, bufsize))) {
-       free(di);
-       goto no_direct;
-    }
-
-    sfsetbuf(f, buf, bufsize);
-    if (sfsetbuf(f, buf, 0) == buf)
-       sfset(f, SF_MALLOC, 1);
-    else {
-       free(buf);
-       free(di);
-       goto no_direct;
-    }
-
-    di->disc.readf = dioread;
-    di->disc.writef = diowrite;
-    di->disc.seekf = NIL(Sfseek_f);
-    di->disc.exceptf = dioexcept;
-    di->cntl = cntl;
-    di->dio = dio;
-
-    if (sfdisc(f, (Sfdisc_t *) di) != (Sfdisc_t *) di) {
-       free(di);
-      no_direct:
-       cntl &= ~FDIRECT;
-       (void) fcntl(f->file, F_SETFL, cntl);
-       return -1;
-    }
-
-    return 0;
-
-#endif /*FDIRECT*/
-}
index 02e5b352583c6361905f644eb289d697122dde56..7b49741b00f9b8cd898ddd01be3dd42238ec2261 100644 (file)
@@ -22,7 +22,6 @@ extern "C" {
 
     _BEGIN_EXTERNS_
 /* functions to create disciplines */
-    extern int sfdcdio(Sfio_t *, size_t);
     extern int sfdcdos(Sfio_t *);
     extern int sfdcfilter(Sfio_t *, const char *);
     extern int sfdclzw(Sfio_t *);
index 6b509c5ca3d5008f1395352e42b71d9ae87d593a..e6366edeb4d0ad4e8b3072852aa75a78a0ff338f 100644 (file)
 /* Define to 1 if you have the `strtoull' function. */
 #define HAVE_STRTOULL 1
 
-/* Define to 1 if you have struct dioattr */
-/* #undef HAVE_STRUCT_DIOATTR */
-
 /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
    */
 /* #undef HAVE_SYS_DIR_H */