From 433938e2bffda441d256d658ff27e13bb55a63c2 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Thu, 15 Jun 2000 13:13:17 +0000 Subject: [PATCH] Some performance improvements. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@469 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DOH/Doh/base.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/DOH/Doh/base.c b/Source/DOH/Doh/base.c index 58a8ec31f..df2994268 100644 --- a/Source/DOH/Doh/base.c +++ b/Source/DOH/Doh/base.c @@ -560,11 +560,17 @@ DohTell(DOH *obj) { int DohGetc(DOH *obj) { + static DOH *lastdoh = 0; DohBase *b = (DohBase *) obj; DohObjInfo *objinfo; + if (obj == lastdoh) { + objinfo = dohtypes[b->type]; + return (objinfo->doh_file->doh_getc)(b); + } if (DohCheck(obj)) { objinfo = dohtypes[b->type]; if (objinfo->doh_file->doh_getc) { + lastdoh = obj; return (objinfo->doh_file->doh_getc)(b); } return EOF; @@ -578,11 +584,18 @@ DohGetc(DOH *obj) { int DohPutc(int ch, DOH *obj) { + static DOH *lastdoh = 0; DohBase *b = (DohBase *) obj; DohObjInfo *objinfo; + + if (obj == lastdoh) { + objinfo = dohtypes[b->type]; + return (objinfo->doh_file->doh_putc)(b,ch); + } if (DohCheck(obj)) { objinfo = dohtypes[b->type]; if (objinfo->doh_file->doh_putc) { + lastdoh = obj; return (objinfo->doh_file->doh_putc)(b,ch); } return EOF;