Skip to content

Commit

Permalink
lex: New function lex_format_to_string().
Browse files Browse the repository at this point in the history
First used in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
  • Loading branch information
blp committed Apr 20, 2015
1 parent 3d61129 commit 363b533
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ovn/lib/lex.c
Expand Up @@ -22,7 +22,27 @@
#include "dynamic-string.h"
#include "json.h"
#include "util.h"


/* Returns a string that represents 'format'. */
const char *
lex_format_to_string(enum lex_format format)
{
switch (format) {
case LEX_F_DECIMAL:
return "decimal";
case LEX_F_HEXADECIMAL:
return "hexadecimal";
case LEX_F_IPV4:
return "IPv4";
case LEX_F_IPV6:
return "IPv6";
case LEX_F_ETHERNET:
return "Ethernet";
default:
abort();
}
}

/* Initializes 'token'. */
void
lex_token_init(struct lex_token *token)
Expand Down
1 change: 1 addition & 0 deletions ovn/lib/lex.h
Expand Up @@ -73,6 +73,7 @@ enum lex_format {
LEX_F_IPV6,
LEX_F_ETHERNET,
};
const char *lex_format_to_string(enum lex_format);

/* A token.
*
Expand Down

0 comments on commit 363b533

Please sign in to comment.