Skip to content

Commit

Permalink
dpif: Make dp_parse_name() normalize its returned type.
Browse files Browse the repository at this point in the history
This means that callers don't have to be concerned with a NULL return value
or unnormalized type.
  • Loading branch information
blp committed May 11, 2011
1 parent 640e1b2 commit 54ed8a5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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));
}
}

Expand Down

0 comments on commit 54ed8a5

Please sign in to comment.