Skip to content

Commit 31a763d

Browse files
cleanup
1 parent bc4daad commit 31a763d

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

profiling/src/timeline.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ use crate::zend::{
44
InternalFunctionHandler,
55
};
66
use crate::REQUEST_LOCALS;
7+
use ddcommon::cstr;
78
use libc::c_char;
89
use log::{error, trace};
910
#[cfg(php_zts)]
1011
use std::cell::Cell;
1112
use std::cell::RefCell;
12-
use std::ffi::CStr;
1313
use std::ptr;
1414
use std::time::Instant;
1515
use std::time::SystemTime;
@@ -193,54 +193,54 @@ pub fn timeline_minit() {
193193
pub unsafe fn timeline_startup() {
194194
let handlers = [
195195
zend::datadog_php_zif_handler::new(
196-
CStr::from_bytes_with_nul_unchecked(b"sleep\0"),
196+
cstr!("sleep"),
197197
ptr::addr_of_mut!(SLEEP_HANDLER),
198198
Some(ddog_php_prof_sleep),
199199
),
200200
zend::datadog_php_zif_handler::new(
201-
CStr::from_bytes_with_nul_unchecked(b"usleep\0"),
201+
cstr!("usleep"),
202202
ptr::addr_of_mut!(USLEEP_HANDLER),
203203
Some(ddog_php_prof_usleep),
204204
),
205205
zend::datadog_php_zif_handler::new(
206-
CStr::from_bytes_with_nul_unchecked(b"time_nanosleep\0"),
206+
cstr!("time_nanosleep"),
207207
ptr::addr_of_mut!(TIME_NANOSLEEP_HANDLER),
208208
Some(ddog_php_prof_time_nanosleep),
209209
),
210210
zend::datadog_php_zif_handler::new(
211-
CStr::from_bytes_with_nul_unchecked(b"time_sleep_until\0"),
211+
cstr!("time_sleep_until"),
212212
ptr::addr_of_mut!(TIME_SLEEP_UNTIL_HANDLER),
213213
Some(ddog_php_prof_time_sleep_until),
214214
),
215215
zend::datadog_php_zif_handler::new(
216-
CStr::from_bytes_with_nul_unchecked(b"frankenphp_handle_request\0"),
216+
cstr!("frankenphp_handle_request"),
217217
ptr::addr_of_mut!(FRANKENPHP_HANDLE_REQUEST_HANDLER),
218218
Some(ddog_php_prof_frankenphp_handle_request),
219219
),
220220
zend::datadog_php_zif_handler::new(
221-
CStr::from_bytes_with_nul_unchecked(b"stream_select\0"),
221+
cstr!("stream_select"),
222222
ptr::addr_of_mut!(STREAM_SELECT_HANDLER),
223223
Some(ddog_php_prof_stream_select),
224224
),
225225
zend::datadog_php_zif_handler::new(
226-
CStr::from_bytes_with_nul_unchecked(b"socket_select\0"),
226+
cstr!("socket_select"),
227227
ptr::addr_of_mut!(SOCKET_SELECT_HANDLER),
228228
Some(ddog_php_prof_socket_select),
229229
),
230230
zend::datadog_php_zif_handler::new(
231-
CStr::from_bytes_with_nul_unchecked(b"curl_multi_select\0"),
231+
cstr!("curl_multi_select"),
232232
ptr::addr_of_mut!(CURL_MULTI_SELECT_HANDLER),
233233
Some(ddog_php_prof_curl_multi_select),
234234
),
235235
// provided by `ext-uv` from https://pecl.php.net/package/uv
236236
zend::datadog_php_zif_handler::new(
237-
CStr::from_bytes_with_nul_unchecked(b"uv_run\0"),
237+
cstr!("uv_run"),
238238
ptr::addr_of_mut!(UV_RUN_HANDLER),
239239
Some(ddog_php_prof_uv_run),
240240
),
241241
// provided by `ext-libevent` from https://pecl.php.net/package/libevent
242242
zend::datadog_php_zif_handler::new(
243-
CStr::from_bytes_with_nul_unchecked(b"event_base_loop\0"),
243+
cstr!("event_base_loop"),
244244
ptr::addr_of_mut!(EVENT_BASE_LOOP_HANDLER),
245245
Some(ddog_php_prof_event_base_loop),
246246
),
@@ -254,22 +254,22 @@ pub unsafe fn timeline_startup() {
254254
let handlers = [
255255
// provided by `ext-ev` from https://pecl.php.net/package/ev
256256
zend::datadog_php_zim_handler::new(
257-
CStr::from_bytes_with_nul_unchecked(b"evloop\0"),
258-
CStr::from_bytes_with_nul_unchecked(b"run\0"),
257+
cstr!("evloop"),
258+
cstr!("run"),
259259
ptr::addr_of_mut!(EV_LOOP_RUN_HANDLER),
260260
Some(ddog_php_prof_ev_loop_run),
261261
),
262262
// provided by `ext-event` from https://pecl.php.net/package/event
263263
zend::datadog_php_zim_handler::new(
264-
CStr::from_bytes_with_nul_unchecked(b"eventbase\0"),
265-
CStr::from_bytes_with_nul_unchecked(b"loop\0"),
264+
cstr!("eventbase"),
265+
cstr!("loop"),
266266
ptr::addr_of_mut!(EVENTBASE_LOOP_HANDLER),
267267
Some(ddog_php_prof_eventbase_loop),
268268
),
269269
// provided by `ext-parallel` from https://pecl.php.net/package/parallel
270270
zend::datadog_php_zim_handler::new(
271-
CStr::from_bytes_with_nul_unchecked(b"parallel\\events\0"),
272-
CStr::from_bytes_with_nul_unchecked(b"poll\0"),
271+
cstr!("parallel\\events"),
272+
cstr!("poll"),
273273
ptr::addr_of_mut!(PARALLEL_EVENTS_POLL_HANDLER),
274274
Some(ddog_php_prof_parallel_events_poll),
275275
),

0 commit comments

Comments
 (0)