From: Erwin Janssen Date: Sat, 24 Sep 2016 12:42:16 +0000 (+0200) Subject: Remove unused code from cgraph: sfdcio X-Git-Tag: untagged-5fc0363bc76319758ff6~1^2^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=877bd8d9853a01c85e0f5341adf476bfe9a84390;p=graphviz Remove unused code from cgraph: sfdcio 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. --- diff --git a/config.iffe b/config.iffe index b053b1453..9a19b23d4 100644 --- a/config.iffe +++ b/config.iffe @@ -105,16 +105,6 @@ compile{ #define HAVE_ICONV_T_DEF 1 }end -compile{ - #include - #include - #include - struct dioattr xx; -}end yes{ -/* Define if you have struct dioattr in . */ -#define HAVE_STRUCT_DIOATTR 1 -}end - compile{ #include void foo() {fesetenv (FE_NONIEEE_ENV);} diff --git a/configure.ac b/configure.ac index fc3a246bb..d7cca6274 100644 --- a/configure.ac +++ b/configure.ac @@ -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 -#include -#include ]], [[ -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 diff --git a/lib/sfio/Sfio_dc/Makefile.am b/lib/sfio/Sfio_dc/Makefile.am index a57a50e96..5a8e55954 100644 --- a/lib/sfio/Sfio_dc/Makefile.am +++ b/lib/sfio/Sfio_dc/Makefile.am @@ -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 index 80aeeaf6c..000000000 --- a/lib/sfio/Sfio_dc/sfdcdio.c +++ /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*/ -} diff --git a/lib/sfio/Sfio_dc/sfdisc.h b/lib/sfio/Sfio_dc/sfdisc.h index 02e5b3525..7b49741b0 100644 --- a/lib/sfio/Sfio_dc/sfdisc.h +++ b/lib/sfio/Sfio_dc/sfdisc.h @@ -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 *); diff --git a/windows/include/config.h b/windows/include/config.h index 6b509c5ca..e6366edeb 100644 --- a/windows/include/config.h +++ b/windows/include/config.h @@ -325,9 +325,6 @@ /* 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 header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */