LCOV - code coverage report
Current view: top level - ext/http - php_http_etag.h (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 8 8 100.0 %
Date: 2015-02-17 20:30:22 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :     +--------------------------------------------------------------------+
       3             :     | PECL :: http                                                       |
       4             :     +--------------------------------------------------------------------+
       5             :     | Redistribution and use in source and binary forms, with or without |
       6             :     | modification, are permitted provided that the conditions mentioned |
       7             :     | in the accompanying LICENSE file are met.                          |
       8             :     +--------------------------------------------------------------------+
       9             :     | Copyright (c) 2004-2014, Michael Wallner <mike@php.net>            |
      10             :     +--------------------------------------------------------------------+
      11             : */
      12             : 
      13             : #ifndef PHP_HTTP_ETAG_H
      14             : #define PHP_HTTP_ETAG_H
      15             : 
      16             : typedef struct php_http_etag {
      17             :         void *ctx;
      18             :         char *mode;
      19             : 
      20             : #ifdef ZTS
      21             :         void ***ts;
      22             : #endif
      23             : } php_http_etag_t;
      24             : 
      25             : PHP_HTTP_API php_http_etag_t *php_http_etag_init(const char *mode TSRMLS_DC);
      26             : PHP_HTTP_API size_t php_http_etag_update(php_http_etag_t *e, const char *data_ptr, size_t data_len);
      27             : PHP_HTTP_API char *php_http_etag_finish(php_http_etag_t *e);
      28             : 
      29          51 : static inline char *php_http_etag_digest(const unsigned char *digest, int len)
      30             : {
      31             :         static const char hexdigits[17] = "0123456789abcdef";
      32             :         int i;
      33          51 :         char *hex = emalloc(len * 2 + 1);
      34          51 :         char *ptr = hex;
      35             : 
      36        1099 :         for (i = 0; i < len; ++i) {
      37        1048 :                 *ptr++ = hexdigits[digest[i] >> 4];
      38        1048 :                 *ptr++ = hexdigits[digest[i] & 0xF];
      39             :         }
      40          51 :         *ptr = '\0';
      41             : 
      42          51 :         return hex;
      43             : }
      44             : 
      45             : #endif /* PHP_HTTP_ETAG_H */
      46             : 
      47             : /*
      48             :  * Local variables:
      49             :  * tab-width: 4
      50             :  * c-basic-offset: 4
      51             :  * End:
      52             :  * vim600: noet sw=4 ts=4 fdm=marker
      53             :  * vim<600: noet sw=4 ts=4
      54             :  */
      55             : 

Generated by: LCOV version 1.11