PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - standard - ftok.c
Test: PHP Code Coverage
Date: 2009-11-23 Instrumented lines: 13
Code covered: 100.0 % Executed lines: 13
Legend: not executed executed

       1                 : /* 
       2                 :    +----------------------------------------------------------------------+
       3                 :    | PHP Version 6                                                        |
       4                 :    +----------------------------------------------------------------------+
       5                 :    | Copyright (c) 1997-2009 The PHP Group                                |
       6                 :    +----------------------------------------------------------------------+
       7                 :    | This source file is subject to version 3.01 of the PHP license,      |
       8                 :    | that is bundled with this package in the file LICENSE, and is        |
       9                 :    | available through the world-wide-web at the following url:           |
      10                 :    | http://www.php.net/license/3_01.txt                                  |
      11                 :    | If you did not receive a copy of the PHP license and are unable to   |
      12                 :    | obtain it through the world-wide-web, please send a note to          |
      13                 :    | license@php.net so we can mail you a copy immediately.               |
      14                 :    +----------------------------------------------------------------------+
      15                 :    | Author: Andrew Sitnikov <sitnikov@infonet.ee>                        |
      16                 :    +----------------------------------------------------------------------+
      17                 : */
      18                 : 
      19                 : /* $Id: ftok.c 276986 2009-03-10 23:40:06Z helly $ */
      20                 : 
      21                 : #include "php.h"
      22                 : #include "ext/standard/file.h"
      23                 : 
      24                 : #include <sys/types.h>                                                                                                        
      25                 : 
      26                 : #ifdef HAVE_SYS_IPC_H
      27                 : #include <sys/ipc.h>
      28                 : #endif
      29                 : 
      30                 : #if HAVE_FTOK
      31                 : /* {{{ proto int ftok(string pathname, string proj) U
      32                 :    Convert a pathname and a project identifier to a System V IPC key */
      33                 : PHP_FUNCTION(ftok)
      34              18 : {
      35                 :         zval **pp_pathname;
      36                 :         char *proj, *pathname;
      37                 :         int proj_len, pathname_len;
      38                 :         key_t k;
      39                 : 
      40              18 :         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &pp_pathname, &proj, &proj_len) == FAILURE ||
      41                 :                 php_stream_path_param_encode(pp_pathname, &pathname, &pathname_len, REPORT_ERRORS, FG(default_context)) == FAILURE) {
      42               3 :                 return;
      43                 :         }
      44                 : 
      45              15 :         if (pathname_len == 0){
      46               1 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pathname is invalid");
      47               1 :                 RETURN_LONG(-1);
      48                 :         }
      49                 : 
      50              14 :         if (proj_len != 1){
      51               2 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Project identifier is invalid");
      52               2 :                 RETURN_LONG(-1);
      53                 :     }
      54                 : 
      55              12 :         k = ftok(pathname, proj[0]);
      56              12 :         if (k == -1) {
      57               1 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftok() failed - %s", strerror(errno));
      58                 :         }
      59                 : 
      60              12 :         RETURN_LONG(k);
      61                 : }
      62                 : /* }}} */
      63                 : #endif
      64                 : 
      65                 : /*
      66                 :  * Local variables:
      67                 :  * tab-width: 4
      68                 :  * c-basic-offset: 4
      69                 :  * End:
      70                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Mon, 23 Nov 2009 17:39:42 +0000 (36 hours ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.