Skip to content

Commit dcc1b72

Browse files
authored
Remove string allocation from hot path (#605)
1 parent 9e5e8b6 commit dcc1b72

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pgml-extension/src/bindings/venv.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use pyo3::prelude::*;
77
use pyo3::types::PyTuple;
88
use std::ffi::CStr;
99

10+
static CONFIG_NAME: &'static str = "pgml.venv";
11+
1012
static PY_MODULE: Lazy<Py<PyModule>> = Lazy::new(|| {
1113
Python::with_gil(|py| -> Py<PyModule> {
1214
let src = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/bindings/venv.py"));
@@ -28,8 +30,7 @@ pub fn activate_venv(venv: &str) -> bool {
2830

2931
pub fn activate() -> bool {
3032
unsafe {
31-
let config_name = "pgml.venv".to_string();
32-
let option = pgrx_pg_sys::GetConfigOption(config_name.as_pg_cstr(), true, false);
33+
let option = pgrx_pg_sys::GetConfigOption(CONFIG_NAME.as_pg_cstr(), true, false);
3334
if option.is_null() {
3435
false
3536
} else {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy