reduce getenv calls by only getting once

we do egetvn's quite frequently and this is more costly than
remembering once and getting it once... fix that in some cases.
This commit is contained in:
Carsten Haitzler 2019-08-08 23:54:09 +01:00
parent 78c26e5f8d
commit ac6ceb0b99
2 changed files with 14 additions and 3 deletions

View File

@ -2049,9 +2049,14 @@ e_config_profile_save(void)
char buf[4096], buf2[4096];
const char *s;
int ok = 0;
static signed char nosave = -1;
if ((s = getenv("E_CONF_PROFILE_NOSAVE")) && atoi(s))
return 1;
if (nosave == -1)
{
if ((s = getenv("E_CONF_PROFILE_NOSAVE")) && atoi(s)) nosave = 1;
else nosave = 0;
}
if (nosave == 1) return 1;
/* FIXME: check for other sessions fo E running */
e_user_dir_concat_static(buf, "config/profile.cfg");

View File

@ -796,11 +796,17 @@ e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns)
if (!cp->buffer) return EINA_FALSE;
if (cp->buffer->dmabuf_buffer)
{
static signed char use_hw_planes = -1;
ns->type = EVAS_NATIVE_SURFACE_WL_DMABUF;
ns->data.wl_dmabuf.attr = &cp->buffer->dmabuf_buffer->attributes;
ns->data.wl_dmabuf.resource = cp->buffer->resource;
if (getenv("E_USE_HARDWARE_PLANES"))
if (use_hw_planes == -1)
{
if (getenv("E_USE_HARDWARE_PLANES")) use_hw_planes = 1;
else use_hw_planes = 0;
}
if (use_hw_planes)
{
ns->data.wl_dmabuf.scanout.handler = _e_pixmap_scanout_handler;
ns->data.wl_dmabuf.scanout.data = cp->buffer;