From 87d97c842306519eacd42f5fe944a10cbdb38c3b Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 22 Mar 2006 17:32:21 +0000 Subject: [PATCH] Simplify and optimize code. --- ext/pgsql/pgsql.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 0ab76f78e3..9d4aa6b26d 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2672,16 +2672,15 @@ PHP_FUNCTION(pg_lo_open) (Jouni) */ - if (strchr(mode_string, 'r') == mode_string) { + if (mode_string[0] == 'r') { pgsql_mode |= INV_READ; - if (strchr(mode_string, '+') == mode_string+1) { + if (mode_string[1] == '+') { pgsql_mode |= INV_WRITE; } - } - if (strchr(mode_string, 'w') == mode_string) { + } else if (mode_string[0] == 'w') { pgsql_mode |= INV_WRITE; create = 1; - if (strchr(mode_string, '+') == mode_string+1) { + if (mode_string[1] == '+') { pgsql_mode |= INV_READ; } } -- 2.50.1