mirror of
https://github.com/php-win-ext/pecl-processing-rrd.git
synced 2026-03-24 00:52:13 +01:00
fix remaining segfaults on php 7
git-svn-id: http://svn.php.net/repository/pecl/rrd/trunk@336985 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
17
rrd.c
17
rrd.c
@@ -17,6 +17,9 @@
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
#include <rrd.h>
|
||||
#ifdef HAVE_RRDC_DISCONNECT
|
||||
#include <rrd_client.h>
|
||||
#endif
|
||||
|
||||
#include "php_rrd.h"
|
||||
#include "rrd_graph.h"
|
||||
@@ -47,7 +50,7 @@ Fetch data from RRD in requested resolution.
|
||||
PHP_FUNCTION(rrd_fetch)
|
||||
{
|
||||
char *filename;
|
||||
int filename_length;
|
||||
size_t filename_length;
|
||||
zval *zv_arr_options;
|
||||
rrd_args *argv;
|
||||
/* returned values if rrd_fetch doesn't fail */
|
||||
@@ -147,7 +150,7 @@ PHP_FUNCTION(rrd_fetch)
|
||||
PHP_FUNCTION(rrd_first)
|
||||
{
|
||||
char *filename;
|
||||
int filename_length;
|
||||
size_t filename_length;
|
||||
long rraindex = 0;
|
||||
/* return value from rrd_first_r call */
|
||||
time_t rrd_first_return_val;
|
||||
@@ -183,7 +186,7 @@ PHP_FUNCTION(rrd_first)
|
||||
PHP_FUNCTION(rrd_last)
|
||||
{
|
||||
char *filename;
|
||||
int filename_length;
|
||||
size_t filename_length;
|
||||
/* return value from rrd_first_r call */
|
||||
time_t rrd_last_return_val;
|
||||
|
||||
@@ -212,7 +215,7 @@ PHP_FUNCTION(rrd_last)
|
||||
PHP_FUNCTION(rrd_lastupdate)
|
||||
{
|
||||
char *filename;
|
||||
int filename_length;
|
||||
size_t filename_length;
|
||||
/* list of arguments for rrd_lastupdate call, it's more efficient then
|
||||
* usage of rrd_args, because there isn't array of arguments in parameters
|
||||
*/
|
||||
@@ -297,7 +300,7 @@ PHP_FUNCTION(rrd_lastupdate)
|
||||
PHP_FUNCTION(rrd_restore)
|
||||
{
|
||||
char *xml_filename, *rrd_filename;
|
||||
int xml_filename_length, rrd_filename_length;
|
||||
size_t xml_filename_length, rrd_filename_length;
|
||||
zval *zv_arr_options = NULL;
|
||||
/* this is merge of options and rrd_filename. This is needed because
|
||||
* rrd_args_init_by_phparray allows only one filename as argument, so
|
||||
@@ -349,7 +352,7 @@ PHP_FUNCTION(rrd_restore)
|
||||
PHP_FUNCTION(rrd_tune)
|
||||
{
|
||||
char *filename;
|
||||
int filename_length;
|
||||
size_t filename_length;
|
||||
zval *zv_arr_options;
|
||||
rrd_args *argv;
|
||||
|
||||
@@ -569,7 +572,7 @@ static zend_function_entry rrd_functions[] = {
|
||||
PHP_FE(rrdc_disconnect, NULL)
|
||||
#endif
|
||||
PHP_FE(rrd_version, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ static zend_object_handlers rrd_create_handlers;
|
||||
of having dedicated creating/cloning/destruction functions
|
||||
*/
|
||||
typedef struct _rrd_create_object {
|
||||
zend_object std;
|
||||
/** path to newly created rrd file */
|
||||
char *file_path;
|
||||
/* "--start" parameters in rrd create */
|
||||
@@ -41,6 +40,7 @@ typedef struct _rrd_create_object {
|
||||
zval zv_arr_data_sources;
|
||||
/* "RRA" parameters in rrd create */
|
||||
zval zv_arr_archives;
|
||||
zend_object std;
|
||||
} rrd_create_object;
|
||||
|
||||
/**
|
||||
@@ -79,7 +79,7 @@ creates new rrd create object
|
||||
static zend_object *rrd_create_object_new(zend_class_entry *ce)
|
||||
{
|
||||
rrd_create_object *intern_obj = ecalloc(1, sizeof(rrd_create_object) +
|
||||
sizeof(zval) * (ce->default_properties_count - 1));
|
||||
zend_object_properties_size(ce));
|
||||
intern_obj->file_path = NULL;
|
||||
intern_obj->start_time = NULL;
|
||||
ZVAL_UNDEF(&intern_obj->zv_step);
|
||||
@@ -329,7 +329,7 @@ static zend_function_entry rrd_create_methods[] = {
|
||||
PHP_ME(RRDCreator, save, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(RRDCreator, addDataSource, arginfo_rrdcreator_description, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(RRDCreator, addArchive, arginfo_rrdcreator_description, ZEND_ACC_PUBLIC)
|
||||
{NULL, NULL, NULL}
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
/* minit hook, called from main module minit */
|
||||
|
||||
@@ -32,9 +32,9 @@ static zend_object_handlers rrd_graph_handlers;
|
||||
* of having dedicated creating/cloning/destruction functions
|
||||
*/
|
||||
typedef struct _rrd_graph_object {
|
||||
zend_object std;
|
||||
char *file_path;
|
||||
zval zv_arr_options;
|
||||
zend_object std;
|
||||
} rrd_graph_object;
|
||||
|
||||
/**
|
||||
@@ -69,7 +69,7 @@ creates new rrd graph object
|
||||
static zend_object *rrd_graph_object_new(zend_class_entry *ce)
|
||||
{
|
||||
rrd_graph_object *intern_obj = ecalloc(1, sizeof(rrd_graph_object) +
|
||||
sizeof(zval) * (ce->default_properties_count - 1));
|
||||
zend_object_properties_size(ce));
|
||||
intern_obj->file_path = NULL;
|
||||
ZVAL_UNDEF(&intern_obj->zv_arr_options);
|
||||
|
||||
@@ -370,7 +370,7 @@ static zend_function_entry rrd_graph_methods[] = {
|
||||
PHP_ME(RRDGraph, save, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(RRDGraph, saveVerbose, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(RRDGraph, setOptions, arginfo_rrd_options, ZEND_ACC_PUBLIC)
|
||||
{NULL, NULL, NULL}
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
/* minit hook, called from main module minit */
|
||||
|
||||
10
rrd_update.c
10
rrd_update.c
@@ -31,9 +31,9 @@ static zend_object_handlers rrd_update_handlers;
|
||||
* of having dedicated creating/cloning/destruction functions
|
||||
*/
|
||||
typedef struct _rrd_update_object {
|
||||
zend_object std;
|
||||
/** path to newly created rrd file */
|
||||
char *file_path;
|
||||
zend_object std;
|
||||
} rrd_update_object;
|
||||
|
||||
/**
|
||||
@@ -63,8 +63,8 @@ creates new rrd update object
|
||||
*/
|
||||
static zend_object *rrd_update_object_new(zend_class_entry *ce)
|
||||
{
|
||||
rrd_update_object *intern_obj = ecalloc(1, sizeof(rrd_update_object) +
|
||||
sizeof(zval) * (ce->default_properties_count - 1));
|
||||
rrd_update_object *intern_obj = ecalloc(1, sizeof(rrd_update_object) +
|
||||
zend_object_properties_size(ce));
|
||||
intern_obj->file_path = NULL;
|
||||
|
||||
zend_object_std_init(&intern_obj->std, ce);
|
||||
@@ -257,7 +257,7 @@ ZEND_END_ARG_INFO()
|
||||
static zend_function_entry rrd_update_methods[] = {
|
||||
PHP_ME(RRDUpdater, __construct, arginfo_rrdupdater_construct, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(RRDUpdater, update, arginfo_rrdupdater_update, ZEND_ACC_PUBLIC)
|
||||
{NULL, NULL, NULL}
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
/* minit hook, called from main module minit */
|
||||
@@ -271,5 +271,5 @@ void rrd_update_minit()
|
||||
memcpy(&rrd_update_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
rrd_update_handlers.clone_obj = NULL;
|
||||
rrd_update_handlers.offset = XtOffsetOf(rrd_update_object, std);
|
||||
rrd_update_handlers.free_obj = rrd_update_object_dtor;
|
||||
rrd_update_handlers.free_obj = rrd_update_object_dtor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user