From: Thomas Graf Date: Fri, 13 Jun 2008 14:40:41 +0000 (+0200) Subject: Introduce nla_strdup() to help parse strings attributes X-Git-Tag: libnl2_0~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d49018fd789d96ec3fa90e41af24fd2796bac9fe;p=thirdparty%2Flibnl.git Introduce nla_strdup() to help parse strings attributes --- diff --git a/include/netlink/attr.h b/include/netlink/attr.h index 052587f..b3a350b 100644 --- a/include/netlink/attr.h +++ b/include/netlink/attr.h @@ -109,6 +109,7 @@ extern int nla_put_u64(struct nl_msg *, int, uint64_t); /* String attribute */ extern char * nla_get_string(struct nlattr *); +extern char * nla_strdup(struct nlattr *); extern int nla_put_string(struct nl_msg *, int, const char *); /* Flag attribute */ diff --git a/lib/attr.c b/lib/attr.c index 3ba7aac..298fbb1 100644 --- a/lib/attr.c +++ b/lib/attr.c @@ -1023,6 +1023,11 @@ char *nla_get_string(struct nlattr *nla) return (char *) nla_data(nla); } +char *nla_strdup(struct nlattr *nla) +{ + return strdup(nla_get_string(nla)); +} + /** @} */ /**