From 54ed8a5d74773e75b79490dc65e65b7498a14fb7 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 11 Apr 2011 15:07:07 -0700 Subject: [PATCH] dpif: Make dp_parse_name() normalize its returned type. This means that callers don't have to be concerned with a NULL return value or unnormalized type. --- lib/dpif.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/dpif.c b/lib/dpif.c index aaa8075b..215ecfcd 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -200,8 +200,10 @@ dp_enumerate_names(const char *type, struct sset *names) return error; } -/* Parses 'datapath name', which is of the form type@name into its - * component pieces. 'name' and 'type' must be freed by the caller. */ +/* Parses 'datapath_name_', which is of the form [type@]name into its + * component pieces. 'name' and 'type' must be freed by the caller. + * + * The returned 'type' is normalized, as if by dpif_normalize_type(). */ void dp_parse_name(const char *datapath_name_, char **name, char **type) { @@ -212,10 +214,10 @@ dp_parse_name(const char *datapath_name_, char **name, char **type) if (separator) { *separator = '\0'; *type = datapath_name; - *name = xstrdup(separator + 1); + *name = xstrdup(dpif_normalize_type(separator + 1)); } else { *name = datapath_name; - *type = NULL; + *type = xstrdup(dpif_normalize_type(NULL)); } } -- 2.30.2