Permalink
Browse files

Merge branch 'create_path_buffer' of https://github.com/lreese/php-zo…

  • Loading branch information...
2 parents 2459d97 + 2d4b7bd commit 27c0593ecb99c08e91abb35670b343e4aba3967e @andreiz committed Apr 4, 2012
Showing with 28 additions and 8 deletions.
  1. +17 −5 package.xml
  2. +11 −3 php_zookeeper.c
View
@@ -15,9 +15,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
<email>andrei@php.net</email>
<active>yes</active>
</lead>
- <date>2012-01-12</date>
+ <date>2012-01-13</date>
<version>
- <release>0.2.0</release>
+ <release>0.2.1</release>
<api>0.2.0</api>
</version>
<stability>
@@ -26,9 +26,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
</stability>
<license uri="http://www.php.net/license">PHP</license>
<notes>
-- Added session handler support
-- Added connect() and delete methods
-- Bug fixes
+- Package up missed source files
</notes>
<contents>
<dir name="/">
@@ -40,6 +38,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file role='src' name='config.m4'/>
<file role='src' name='php_zookeeper.c'/>
<file role='src' name='php_zookeeper.h'/>
+ <file role='src' name='php_zookeeper_private.h'/>
+ <file role='src' name='php_zookeeper_session.c'/>
+ <file role='src' name='php_zookeeper_session.h'/>
+ <file role='src' name='zoo_lock.c'/>
+ <file role='src' name='zoo_lock.h'/>
</dir> <!-- / -->
</contents>
<dependencies>
@@ -59,6 +62,15 @@ http://pear.php.net/dtd/package-2.0.xsd">
<changelog>
<release>
<stability><release>beta</release><api>beta</api></stability>
+ <version><release>0.2.1</release><api>0.2.0</api></version>
+ <date>2012-01-13</date>
+ <notes>
+- Package up missed source files
+ </notes>
+ </release>
+
+ <release>
+ <stability><release>beta</release><api>beta</api></stability>
<version><release>0.2.0</release><api>0.2.0</api></version>
<date>2012-01-12</date>
<notes>
View
@@ -189,8 +189,8 @@ static PHP_METHOD(Zookeeper, create)
int path_len, value_len;
zval *acl_info = NULL;
long flags = 0;
- char realpath[256];
- int realpath_max = 256;
+ char *realpath;
+ int realpath_max = 0;
struct ACL_vector aclv = { 0, };
int status = ZOK;
ZK_METHOD_INIT_VARS;
@@ -202,15 +202,23 @@ static PHP_METHOD(Zookeeper, create)
ZK_METHOD_FETCH_OBJECT;
+ realpath_max = path_len + 1;
+ if (flags & ZOO_SEQUENCE) {
+ // allocate extra space for sequence numbers
+ realpath_max += 11;
+ }
+ realpath = emalloc(realpath_max);
+
php_parse_acl_list(acl_info, &aclv);
status = zoo_create(i_obj->zk, path, value, value_len, (acl_info ? &aclv : 0), flags,
realpath, realpath_max);
if (status != ZOK) {
+ efree(realpath);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "error: %s", zerror(status));
return;
}
- RETURN_STRING(realpath, 1);
+ RETURN_STRING(realpath, 0);
}
/* }}} */

0 comments on commit 27c0593

Please sign in to comment.