1973 *equals = '\0';
1974 v = mdb_nv_lookup(&pt->p_env, val);
1975
1976 if (v != NULL) {
1977 char *old = mdb_nv_get_cookie(v);
1978 mdb_free(old, strlen(old) + 1);
1979 name = mdb_nv_get_name(v);
1980 } else {
1981 /*
1982 * The environment is created using MDB_NV_EXTNAME, so we must
1983 * provide external storage for the variable names.
1984 */
1985 name = strdup(val);
1986 }
1987
1988 *equals = '=';
1989
1990 (void) mdb_nv_insert(&pt->p_env, name, NULL, (uintptr_t)val,
1991 MDB_NV_EXTNAME);
1992
1993 if (equals)
1994 *equals = '=';
1995 }
1996
1997 /*
1998 * Clears the internal environment.
1999 */
2000 static void
2001 pt_env_clear(pt_data_t *pt)
2002 {
2003 mdb_var_t *v;
2004 char *val, *name;
2005
2006 mdb_nv_rewind(&pt->p_env);
2007 while ((v = mdb_nv_advance(&pt->p_env)) != NULL) {
2008
2009 name = (char *)mdb_nv_get_name(v);
2010 val = mdb_nv_get_cookie(v);
2011
2012 mdb_nv_remove(&pt->p_env, v);
2013
|
1973 *equals = '\0';
1974 v = mdb_nv_lookup(&pt->p_env, val);
1975
1976 if (v != NULL) {
1977 char *old = mdb_nv_get_cookie(v);
1978 mdb_free(old, strlen(old) + 1);
1979 name = mdb_nv_get_name(v);
1980 } else {
1981 /*
1982 * The environment is created using MDB_NV_EXTNAME, so we must
1983 * provide external storage for the variable names.
1984 */
1985 name = strdup(val);
1986 }
1987
1988 *equals = '=';
1989
1990 (void) mdb_nv_insert(&pt->p_env, name, NULL, (uintptr_t)val,
1991 MDB_NV_EXTNAME);
1992
1993 *equals = '=';
1994 }
1995
1996 /*
1997 * Clears the internal environment.
1998 */
1999 static void
2000 pt_env_clear(pt_data_t *pt)
2001 {
2002 mdb_var_t *v;
2003 char *val, *name;
2004
2005 mdb_nv_rewind(&pt->p_env);
2006 while ((v = mdb_nv_advance(&pt->p_env)) != NULL) {
2007
2008 name = (char *)mdb_nv_get_name(v);
2009 val = mdb_nv_get_cookie(v);
2010
2011 mdb_nv_remove(&pt->p_env, v);
2012
|