Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions rrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ PHP_FUNCTION(rrd_fetch)
/* pointer for one data source retrieved data */
zval *ds_data_array;
/* value for key (timestamp) in data array */
char str_timestamp[11];
ZEND_LTOA((zend_ulong)timestamp, str_timestamp, sizeof(str_timestamp));
char str_timestamp[65];
snprintf(str_timestamp, sizeof(str_timestamp), ZEND_ULONG_FMT, (zend_ulong)timestamp);

/* gets pointer for data source result array */
ds_data_array = zend_hash_get_current_data(Z_ARRVAL(zv_data_array));
Expand Down Expand Up @@ -334,7 +334,7 @@ PHP_FUNCTION(rrd_restore)
argv = rrd_args_init_by_phparray("restore", xml_filename, &zv_options);
if (!argv) {
zend_error(E_WARNING, "cannot allocate arguments options");
zval_dtor(&zv_options);
zval_ptr_dtor_nogc(&zv_options);
RETURN_FALSE;
}

Expand All @@ -346,7 +346,7 @@ PHP_FUNCTION(rrd_restore)
} else {
RETVAL_TRUE;
}
zval_dtor(&zv_options);
zval_ptr_dtor_nogc(&zv_options);
rrd_args_free(argv);
}
/* }}} */
Expand Down Expand Up @@ -463,8 +463,8 @@ PHP_FUNCTION(rrd_xport)
data_ptr = data + outvar_index;
for (time_index = start + step; time_index <= end; time_index += step) {
/* value for key (timestamp) in data array */
char str_timestamp[11];
ZEND_LTOA((zend_ulong)time_index, str_timestamp, sizeof(str_timestamp));
char str_timestamp[65];
snprintf(str_timestamp, sizeof(str_timestamp), ZEND_ULONG_FMT, (zend_ulong)time_index);

add_assoc_double(&time_data, str_timestamp, *data_ptr);
data_ptr += outvar_count;
Expand Down
16 changes: 8 additions & 8 deletions rrd_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef struct _rrd_create_object {
* fetch our custom object from user space object
*/
static inline rrd_create_object *php_rrd_create_fetch_object(zend_object *obj) {
return (rrd_create_object *)((char*)(obj) - XtOffsetOf(rrd_create_object, std));
return (rrd_create_object *)((char*)(obj) - offsetof(rrd_create_object, std));
}

/* {{{ rrd_create_object_dtor
Expand All @@ -63,11 +63,11 @@ static void rrd_create_object_dtor(zend_object *object)
if (intern_obj->start_time)
efree(intern_obj->start_time);
if (!Z_ISUNDEF(intern_obj->zv_step))
zval_dtor(&intern_obj->zv_step);
zval_ptr_dtor_nogc(&intern_obj->zv_step);
if (!Z_ISUNDEF(intern_obj->zv_arr_data_sources))
zval_dtor(&intern_obj->zv_arr_data_sources);
zval_ptr_dtor_nogc(&intern_obj->zv_arr_data_sources);
if (!Z_ISUNDEF(intern_obj->zv_arr_archives))
zval_dtor(&intern_obj->zv_arr_archives);
zval_ptr_dtor_nogc(&intern_obj->zv_arr_archives);

zend_object_std_dtor(&intern_obj->std);
}
Expand Down Expand Up @@ -255,15 +255,15 @@ PHP_METHOD(RRDCreator, save)
create_argv = rrd_args_init_by_phparray("create", intern_obj->file_path, &zv_create_argv);
if (!create_argv) {
zend_error(E_WARNING, "cannot allocate arguments options");
zval_dtor(&zv_create_argv);
zval_ptr_dtor_nogc(&zv_create_argv);
RETURN_FALSE;
}

if (rrd_test_error()) rrd_clear_error();

/* call rrd_create and test if fails */
if (rrd_create(create_argv->count - 1, &create_argv->args[1]) == -1) {
zval_dtor(&zv_create_argv);
zval_ptr_dtor_nogc(&zv_create_argv);
rrd_args_free(create_argv);

/* throw exception with rrd error string */
Expand All @@ -272,7 +272,7 @@ PHP_METHOD(RRDCreator, save)
return;
}

zval_dtor(&zv_create_argv);
zval_ptr_dtor_nogc(&zv_create_argv);
rrd_args_free(create_argv);
RETURN_TRUE;
}
Expand Down Expand Up @@ -345,6 +345,6 @@ void rrd_create_minit()

memcpy(&rrd_create_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
rrd_create_handlers.clone_obj = NULL;
rrd_create_handlers.offset = XtOffsetOf(rrd_create_object, std);
rrd_create_handlers.offset = offsetof(rrd_create_object, std);
rrd_create_handlers.free_obj = rrd_create_object_dtor;
}
10 changes: 5 additions & 5 deletions rrd_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef struct _rrd_graph_object {
* fetch our custom object from user space object
*/
static inline rrd_graph_object *php_rrd_graph_fetch_object(zend_object *obj) {
return (rrd_graph_object *)((char*)(obj) - XtOffsetOf(rrd_graph_object, std));
return (rrd_graph_object *)((char*)(obj) - offsetof(rrd_graph_object, std));
}

/* {{{ rrd_graph_object_dtor
Expand All @@ -60,7 +60,7 @@ static void rrd_graph_object_dtor(zend_object *object)
efree(intern_obj->file_path);
}
if (!Z_ISUNDEF(intern_obj->zv_arr_options)) {
zval_dtor(&intern_obj->zv_arr_options);
zval_ptr_dtor_nogc(&intern_obj->zv_arr_options);
}

zend_object_std_dtor(&intern_obj->std);
Expand Down Expand Up @@ -120,7 +120,7 @@ PHP_METHOD(RRDGraph, setOptions)

/* if our array is initialized, so delete it first */
if (!Z_ISUNDEF(intern_obj->zv_arr_options)) {
zval_dtor(&intern_obj->zv_arr_options);
zval_ptr_dtor_nogc(&intern_obj->zv_arr_options);
}

/* copy array from parameter */
Expand Down Expand Up @@ -169,7 +169,7 @@ static rrd_args *rrd_graph_obj_create_argv(const char *command_name, const rrd_g
} ZEND_HASH_FOREACH_END();

result = rrd_args_init_by_phparray(command_name, obj->file_path, &zv_argv);
zval_dtor(&zv_argv);
zval_ptr_dtor_nogc(&zv_argv);

return result;
}
Expand Down Expand Up @@ -391,6 +391,6 @@ void rrd_graph_minit()

memcpy(&rrd_graph_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
rrd_graph_handlers.clone_obj = NULL;
rrd_graph_handlers.offset = XtOffsetOf(rrd_graph_object, std);
rrd_graph_handlers.offset = offsetof(rrd_graph_object, std);
rrd_graph_handlers.free_obj = rrd_graph_object_dtor;
}
10 changes: 5 additions & 5 deletions rrd_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ typedef struct _rrd_update_object {
* fetch our custom object from user space object
*/
static inline rrd_update_object *php_rrd_update_fetch_object(zend_object *obj) {
return (rrd_update_object *)((char*)(obj) - XtOffsetOf(rrd_update_object, std));
return (rrd_update_object *)((char*)(obj) - offsetof(rrd_update_object, std));
}

/* {{{ rrd_update_object_dtor
Expand Down Expand Up @@ -179,7 +179,7 @@ PHP_METHOD(RRDUpdater, update)
update_argv = rrd_args_init_by_phparray("update", intern_obj->file_path, &zv_update_argv);
if (!update_argv) {
zend_error(E_WARNING, "cannot allocate arguments options");
zval_dtor(&zv_update_argv);
zval_ptr_dtor_nogc(&zv_update_argv);
if (time_str_length == 0) efree(time);
RETURN_FALSE;
}
Expand All @@ -188,7 +188,7 @@ PHP_METHOD(RRDUpdater, update)

/* call rrd_update and test if fails */
if (rrd_update(update_argv->count - 1, &update_argv->args[1]) == -1) {
zval_dtor(&zv_update_argv);
zval_ptr_dtor_nogc(&zv_update_argv);
rrd_args_free(update_argv);

/* throw exception with rrd error string */
Expand All @@ -197,7 +197,7 @@ PHP_METHOD(RRDUpdater, update)
return;
}

zval_dtor(&zv_update_argv);
zval_ptr_dtor_nogc(&zv_update_argv);
rrd_args_free(update_argv);

RETURN_TRUE;
Expand Down Expand Up @@ -265,6 +265,6 @@ 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.offset = offsetof(rrd_update_object, std);
rrd_update_handlers.free_obj = rrd_update_object_dtor;
}
Loading