mirror of git://git.gnupg.org/gnupg.git
common: New function nve_set
* common/name-value.c (nve_set): New.
--
Taken from 2.2 commit 706adf6691
This commit is contained in:
parent
f15a643a2d
commit
ec0c35d1b8
|
@ -497,6 +497,30 @@ nvc_set (nvc_t pk, const char *name, const char *value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Update entry E to VALUE. */
|
||||||
|
gpg_error_t
|
||||||
|
nve_set (nve_t e, const char *value)
|
||||||
|
{
|
||||||
|
char *v;
|
||||||
|
|
||||||
|
if (!e)
|
||||||
|
return GPG_ERR_INV_ARG;
|
||||||
|
|
||||||
|
v = xtrystrdup (value? value:"");
|
||||||
|
if (!v)
|
||||||
|
return my_error_from_syserror ();
|
||||||
|
|
||||||
|
free_strlist_wipe (e->raw_value);
|
||||||
|
e->raw_value = NULL;
|
||||||
|
if (e->value)
|
||||||
|
wipememory (e->value, strlen (e->value));
|
||||||
|
xfree (e->value);
|
||||||
|
e->value = v;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Delete the given entry from PK. */
|
/* Delete the given entry from PK. */
|
||||||
void
|
void
|
||||||
nvc_delete (nvc_t pk, nve_t entry)
|
nvc_delete (nvc_t pk, nve_t entry)
|
||||||
|
|
|
@ -92,6 +92,9 @@ gpg_error_t nvc_add (nvc_t pk, const char *name, const char *value);
|
||||||
first entry is updated. */
|
first entry is updated. */
|
||||||
gpg_error_t nvc_set (nvc_t pk, const char *name, const char *value);
|
gpg_error_t nvc_set (nvc_t pk, const char *name, const char *value);
|
||||||
|
|
||||||
|
/* Update entry E to VALUE. */
|
||||||
|
gpg_error_t nve_set (nve_t e, const char *value);
|
||||||
|
|
||||||
/* Delete the given entry from PK. */
|
/* Delete the given entry from PK. */
|
||||||
void nvc_delete (nvc_t pk, nve_t pke);
|
void nvc_delete (nvc_t pk, nve_t pke);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue