File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -197,17 +197,22 @@ NR_PHP_WRAPPER(nr_mongodb_operation_after) {
197197 .port_path_or_id = NULL ,
198198 .database_name = NULL ,
199199 };
200+
201+ // tell the compiler to ignore the cast from const char * to char *
202+ // to save having to do a strdup operation
203+ #pragma GCC diagnostic push
204+ #pragma GCC diagnostic ignored "-Wcast-qual"
200205 nr_segment_datastore_params_t params = {
201206 .datastore = {
202207 .type = NR_DATASTORE_MONGODB ,
203208 },
204- .operation = nr_strdup ( wraprec -> extra ) ,
209+ .operation = ( char * ) wraprec -> extra ,
205210 .instance = & instance ,
206211 .callbacks = {
207212 .backtrace = nr_php_backtrace_callback ,
208213 },
209214 };
210-
215+ #pragma GCC diagnostic pop
211216 /*
212217 * We check for the interface all Collection operations extend, rather than
213218 * their specific class. Not all operations have the properties we need but
@@ -245,7 +250,6 @@ NR_PHP_WRAPPER(nr_mongodb_operation_after) {
245250 nr_php_scope_release (& this_var );
246251 nr_free (instance .host );
247252 nr_free (instance .port_path_or_id );
248- nr_free (params .operation );
249253}
250254NR_PHP_WRAPPER_END
251255
You can’t perform that action at this time.
0 commit comments