iliaa Thu Nov 4 19:05:56 2004 EDT Modified files: /php-src/ext/shmop shmop.c Log: Simplify and cleanup code. http://cvs.php.net/diff.php/php-src/ext/shmop/shmop.c?r1=1.27&r2=1.28&ty=u Index: php-src/ext/shmop/shmop.c diff -u php-src/ext/shmop/shmop.c:1.27 php-src/ext/shmop/shmop.c:1.28 --- php-src/ext/shmop/shmop.c:1.27 Thu Jan 8 03:17:25 2004 +++ php-src/ext/shmop/shmop.c Thu Nov 4 19:05:55 2004 @@ -16,7 +16,7 @@ | Ilia Alshanetsky <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: shmop.c,v 1.27 2004/01/08 08:17:25 andi Exp $ */ +/* $Id: shmop.c,v 1.28 2004/11/05 00:05:55 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -164,34 +164,33 @@ break; default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid access mode"); - efree(shmop); - RETURN_FALSE; + goto err; } shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg); if (shmop->shmid == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to attach or create shared memory segment"); - efree(shmop); - RETURN_FALSE; + goto err; } if (shmctl(shmop->shmid, IPC_STAT, &shm)) { - efree(shmop); php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to get shared memory segment information"); - RETURN_FALSE; + goto err; } shmop->addr = shmat(shmop->shmid, 0, shmop->shmatflg); if (shmop->addr == (char*) -1) { - efree(shmop); php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to attach to shared memory segment"); - RETURN_FALSE; + goto err; } shmop->size = shm.shm_segsz; rsid = zend_list_insert(shmop, shm_type); RETURN_LONG(rsid); +err: + efree(shmop); + RETURN_FALSE; } /* }}} */ @@ -222,12 +221,7 @@ RETURN_FALSE; } - if (start + count > shmop->size) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "count is out of range"); - RETURN_FALSE; - } - - if (count < 0 ){ + if (start + count > shmop->size || count < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "count is out of range"); RETURN_FALSE; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php