From 44687f75434ea938e9d29fdc3696ff4bdc0978fa Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 16 Jan 2013 14:50:24 +0100 Subject: fw_cfg: New fw_cfg_add_string() Signed-off-by: Markus Armbruster Signed-off-by: Blue Swirl --- hw/fw_cfg.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'hw/fw_cfg.c') diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c index 0361f684b4..3d6dd5fb3a 100644 --- a/hw/fw_cfg.c +++ b/hw/fw_cfg.c @@ -385,6 +385,13 @@ void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len) s->entries[arch][key].len = len; } +void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value) +{ + size_t sz = strlen(value) + 1; + + return fw_cfg_add_bytes(s, key, (uint8_t *)g_memdup(value, sz), sz); +} + void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value) { uint16_t *copy; -- cgit v1.2.3