From 02d4c4f7969bd3f23fa712f1eb387dc160bf2d6c Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 17 Oct 2020 13:01:51 -0700 Subject: [PATCH] remove SFMTXUNLOCK() no-op --- lib/sfio/sfhdr.h | 1 - lib/sfio/sfmode.c | 1 - lib/sfio/sfstack.c | 20 +++++++------------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/sfio/sfhdr.h b/lib/sfio/sfhdr.h index 7db0b8d57..83bcca2c4 100644 --- a/lib/sfio/sfhdr.h +++ b/lib/sfio/sfhdr.h @@ -85,7 +85,6 @@ extern "C" { #undef SF_MTSAFE /* no need to worry about thread-safety */ #define SF_MTSAFE 0 -#define SFMTXUNLOCK(f) (void)(0) #define SFMTXSTART(f,v) { if(!f) return(v); } #define SFMTXRETURN(f,v) { return(v); } diff --git a/lib/sfio/sfmode.c b/lib/sfio/sfmode.c index 657855c2c..479d2c81a 100644 --- a/lib/sfio/sfmode.c +++ b/lib/sfio/sfmode.c @@ -77,7 +77,6 @@ static void _sfcleanup(void) (void) SFSETBUF(f, NIL(void *), 0); f->mode |= pool; - SFMTXUNLOCK(f); SFOPEN(f, 0); } } diff --git a/lib/sfio/sfstack.c b/lib/sfio/sfstack.c index 2c765c496..c5f9462c6 100644 --- a/lib/sfio/sfstack.c +++ b/lib/sfio/sfstack.c @@ -12,19 +12,13 @@ *************************************************************************/ #include - +#include /* Push/pop streams ** ** Written by Kiem-Phong Vo. */ -#define STKMTXRETURN(f1,f2,rv) \ - { if(f1) SFMTXUNLOCK(f1); \ - if(f2) SFMTXUNLOCK(f2); \ - return(rv); \ - } - /** * @param f1 base of stack * @param f2 top of stack @@ -36,22 +30,22 @@ Sfio_t *sfstack(Sfio_t * f1, Sfio_t * f2) Sfrsrv_t *rsrv; if (f1 && (f1->mode & SF_RDWR) != f1->mode && _sfmode(f1, 0, 0) < 0) - STKMTXRETURN(f1, f2, NIL(Sfio_t *)); + return NULL; if (f2 && (f2->mode & SF_RDWR) != f2->mode && _sfmode(f2, 0, 0) < 0) - STKMTXRETURN(f1, f2, NIL(Sfio_t *)); + return NULL; if (!f1) - STKMTXRETURN(f1, f2, f2); + return f2; /* give access to other internal functions */ _Sfstack = sfstack; if (f2 == SF_POPSTACK) { if (!(f2 = f1->push)) - STKMTXRETURN(f1, f2, NIL(Sfio_t *)); + return NULL; f2->mode &= ~SF_PUSH; } else { if (f2->push) - STKMTXRETURN(f1, f2, NIL(Sfio_t *)); + return NULL; if (f1->pool && f1->pool != &_Sfpool && f1->pool != f2->pool && f1 == f1->pool->sf[0]) { /* get something else to pool front since f1 will be locked */ for (n = 1; n < f1->pool->n_sf; ++n) { if (SFFROZEN(f1->pool->sf[n])) @@ -89,5 +83,5 @@ Sfio_t *sfstack(Sfio_t * f1, Sfio_t * f2) SFOPEN(f1, 0); SFOPEN(f2, 0); - STKMTXRETURN(f1, f2, rf); + return rf; } -- 2.40.0