Skip to content

Commit

Permalink
Merged pull request #8
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed May 23, 2016
2 parents 754a5cc + 639452f commit fa23519
Show file tree
Hide file tree
Showing 31 changed files with 575 additions and 320 deletions.
2 changes: 1 addition & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PHP_ARG_ENABLE(quickhash, whether to enable quickhash support,
[ --enable-quickhash Enable quickhash support])

if test "$PHP_QUICKHASH" != "no"; then
PHP_NEW_EXTENSION(quickhash, quickhash.c qh_inthash.c qh_intset.c qh_intstringhash.c qh_stringinthash.c qh_iterator.c lib/quickhash.c lib/hash-algorithms.c lib/iterator.c, $ext_shared)
PHP_NEW_EXTENSION(quickhash, quickhash.c qh_inthash.c qh_intset.c qh_intstringhash.c qh_stringinthash.c qh_iterator.c lib/quickhash.c lib/hash-algorithms.c lib/iterator.c, $ext_shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_SUBST(QUICKHASH_SHARED_LIBADD)
PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
fi
9 changes: 3 additions & 6 deletions lib/hash-algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/

#if HAVE_CONFIG_H
# include <config.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <stdint.h>
#include <stdlib.h>

#ifndef QH_HASH_ALGORITHMS_H
#define QH_HASH_ALGORITHMS_H
Expand Down
4 changes: 2 additions & 2 deletions lib/quickhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static inline int compare_key(qhi *hash, qhb *bucket, qhv key)
* Returns:
* - A newly allocated hash bucket or NULL upon allocation failure
*/
inline qhb *qhb_create(qhi *hash)
extern inline qhb *qhb_create(qhi *hash)
{
void *tmp = NULL;
size_t ptr_size = 0;
Expand Down Expand Up @@ -401,7 +401,7 @@ void qhi_free(qhi *hash)
* Returns:
* - The hashed key
*/
inline uint32_t qhi_set_hash(qhi *hash, qhv key)
extern inline uint32_t qhi_set_hash(qhi *hash, qhv key)
{
uint32_t idx;

Expand Down
21 changes: 6 additions & 15 deletions lib/quickhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,15 @@
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/

#if HAVE_CONFIG_H
# include <config.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#endif
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>

#ifndef QUICK_HASH_H
#define QUICK_HASH_H
Expand Down
14 changes: 6 additions & 8 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,26 @@ xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/ta
hash, integer to string hash and a string to integer hash. The main features
are low memory consumption and fast serialization and deserialization of
the sets and hashes.

</description>
<lead>
<name>Derick Rethans</name>
<user>derick</user>
<email>derick@php.net</email>
<active>yes</active>
</lead>
<date>2012-09-02</date>
<time>22:44:00</time>
<date>2016-05-22</date>
<time>09:00:00</time>
<version>
<release>1.0.0</release>
<release>1.1.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license/3_01.txt">The PHP License</license>
<notes>
Implemented ArrayAccess for QuickHashIntSet
</notes>
<notes>PHP 7 support</notes>
<contents>
<dir name="/">
<file name="config.m4" role="src" />
Expand Down Expand Up @@ -61,7 +59,7 @@ Implemented ArrayAccess for QuickHashIntSet
<dependencies>
<required>
<php>
<min>5.2.0</min>
<min>5.5.0</min>
</php>
<pearinstaller>
<min>1.4.0b1</min>
Expand Down
11 changes: 9 additions & 2 deletions php_quickhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ PHP_MINFO_FUNCTION(quickhash);

ZEND_BEGIN_MODULE_GLOBALS(quickhash)
/* empty */
ZEND_END_MODULE_GLOBALS(quickhash)
ZEND_END_MODULE_GLOBALS(quickhash)

#ifdef ZTS
# define QUICKHASH_G(v) TSRMG(quickhash_globals_id, zend_quickhash_globals *, v)
# if PHP_VERSION_ID < 70000
# define QUICKHASH_G(v) TSRMG(quickhash_globals_id, zend_quickhash_globals *, v)
# else
# if defined(COMPILE_DL_QUICKHASH)
ZEND_TSRMLS_CACHE_EXTERN();
# endif
# define QUICKHASH_G(v) ZEND_TSRMG(quickhash_globals_id, zend_quickhash_globals *, v)
# endif
#else
# define QUICKHASH_G(v) (quickhash_globals.v)
#endif
Expand Down
Loading

0 comments on commit fa23519

Please sign in to comment.