Skip to content

Commit

Permalink
fix flat namespace error
Browse files Browse the repository at this point in the history
  • Loading branch information
neatlife committed Aug 15, 2018
1 parent fcc9324 commit 6cedacd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
25 changes: 24 additions & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ dnl Make sure that the comment is aligned:
[ --enable-h3 Enable h3 support])

if test "$PHP_H3" != "no"; then
dnl EXTRA_FLAGS=" -lh3 -std=c++0x -stdlib=libstdc++"
dnl C_FLAGS=" -lh3 -std=c99"
dnl CXX_FLAGS=" -lh3 -std=c++0x -stdlib=libstdc++"
dnl PHP_REQUIRE_CXX()
dnl EXTRA_FLAGS="-std=c++0x -stdlib=libstdc++"
dnl PHP_SUBST(H3_SHARED_LIBADD)
dnl PHP_ADD_LIBRARY(stdc++, 1, H3_SHARED_LIBADD)
dnl Write more examples of tests here...

dnl # --with-h3 -> check with-path
Expand Down Expand Up @@ -58,6 +65,22 @@ if test "$PHP_H3" != "no"; then
dnl ])
dnl
dnl PHP_SUBST(H3_SHARED_LIBADD)
EXTRA_CFLAGS="-lh3"
PHP_SUBST(EXTRA_CFLAGS)

PHP_NEW_EXTENSION(h3, h3/src/h3lib/lib/*.c h3.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
LIBNAME=h3
LIBSYMBOL=degsToRads
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
[
PHP_ADD_LIBRARY($LIBNAME)
],[
AC_MSG_ERROR([wrong libh3 is required or lib not found])
],[
-l$LIBNAME
])

PHP_SUBST(H3_SHARED_LIBADD)

LIBS="-lh3 $LIBS"
PHP_NEW_EXTENSION(h3, h3.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
3 changes: 2 additions & 1 deletion h3.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ PHP_FUNCTION(h3ToGeoBoundary)
zend_hash_init(Z_ARRVAL(boundary_arr), boundary.numVerts, NULL, ZVAL_PTR_DTOR, 1);
// Indexes can have different number of vertices under some cases,
// which is why boundary.numVerts is needed.
for (int v = 0; v < boundary.numVerts; v++) {
int v = 0;
for (v = 0; v < boundary.numVerts; v++) {
zval *lat = NULL, *lon = NULL;
ZVAL_LONG(lat, boundary.verts[v].lat);
ZVAL_LONG(lon, boundary.verts[v].lon);
Expand Down

0 comments on commit 6cedacd

Please sign in to comment.